Let's say I have a partPart1
. The CFrame I want to move it to is the CFrame of another part, Part2
.
I want to use CFrame:lerp()
to move it with tweening its CFrame, with a delay of d
. How do I do this?
Ok, at first glimpse Lerp() may seem complicated, but its rather simple. Solerp stands for Linear Interpolation. Lerping is a mathematical technique for producing intermediate states between a start and an endpoint. This is very similar to how you tween guis. To use lerp, you need to loop may a loop so it can smoothly glide to another Cframe.
--------------Variables---------------- Part1 = game.Workspace.part1 Part2 = game.Workspace.part2 d = nil ------------Code------------------------ for i = 0,1, .1 do d = i Part1.CFrame = Part1.CFrame:lerp(Part2.CFrame(d) wait() end
This will make the part lerp from its current position to another
~~Hope I Helped