I don't really understand how to use CFrame:lerp(), can someone explain?
My attempt that doesn't work
part = script.Parent startCFrame = part.CFrame endCFrame = CFrame.new(-28.8, 0.5, 31.8) part.ClickDetector.MouseClick:connect(function() for i = 0, 1, 0.1 do part.CFrame = startCFrame:lerp(endCFrame) end end)
Linear interpolation
lerp(start, end, alpha) -> start + (end-start)*alpha
For you, this means that you simply need to add i
to your Lerp, and make sure you include a wait()
so that you can see it happening.
part = script.Parent startCFrame = part.CFrame endCFrame = CFrame.new(-28.8, 0.5, 31.8) part.ClickDetector.MouseClick:connect(function() for i = 0, 1, 0.1 do part.CFrame = startCFrame:lerp(endCFrame,i); wait(); end end)