I understand it's interpolation, but how would you use it in a script?
✓ ANSWER ACCEPTED
How does lerp() work?
1 answer
✓ Accepted answer
lerp takes a parts current cframe and generates a path with a number (alpha between 0 and 1) depicting the starting cframe and the end cframe (with other cframes inbetween 0 and 1). You would start this out with a simple Part
local part = Instance.new('Part', workspace)
You would then create a for statement to create a smooth CFraming
for i = 0, 1, 0.0001 do
-- Lerp here
wait(0.01) -- small numbers for Smooth CFraming
end
Next you would call the lerp method inside the for loop lerp can only be called as a method on CFrames
part.CFrame = part.CFrame:lerp(part.CFrame+Vector3.new(21,04,30),i)
Together it would look like
local part = Instance.new('Part', workspace)
for i = 0, 1, 0.0001 do
part.CFrame = part.CFrame:lerp(part.CFrame+Vector3.new(21,04,30),i)
wait(0.01)
end
Thats it really. have a nice time with your new knowledge!
2 comments
0
I just want to clarify that the first argument is the goal CFrame
0
Yes
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
BlueTaslem answers the question here https://scriptinghelpers.org/questions/31528/how-am-i-using-lerp-wrong