Lerp/Lerping

Learn What's Lerping and how to use it

by srpskic

Author Avatar

So Lerping is simular to Tween Service, but it can get laggy sometimes Most people think that lerping is hard, but it's very easy

So let's start First lets insert 2 parts inside workspace Name First Part2 and second Part1 MAKE SURE THAT THEY ARE ANCHORED!!! Insert an script inside "Part1"

local Part1 = workspace.Part1
local Part2 = workspace.Part2

Part1.CFrame = Part1.CFrame:Lerp(Part2.CFrame,0.5)

--Firstly we added variables -- At third line there is lerping we used cframe so it will copy even the rotation 0.5 means half way there (50% done) --This first code will make it fast and not smoothly if we want to make it smoothly we will need to add "For Loops"

 for i = 0,1,.01 do  -- i think you understand for loops by now
    Part1.CFrame = Part1.CFrame:Lerp(Part2.CFrame,i)
   -- now as you could see we didn't add any number instead we added "i"
   wait()
end

--as you could see Lerp requiers 2 parametars (Goal to where we want to lerp it, and precentage (how much of a way we want it ) final code:

local Part1 = workspace.Part1
local Part2 = workspace.Part2

 for i = 0,1,.01 do  -- Will incrise it 0.01 precent of the way
    Part1.CFrame = Part1.CFrame:Lerp(Part2.CFrame,i)
    wait() --Adds an wait so we can see it happen
 end

Thats it for this tutorial, hope that it helped you.

See you to the next time (Sorry for some bugs and grammar mistakes they re fixed now I think)

View in-game to comment, award, and more!