Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

how to get the difference of two different objects in cframe?

so i need to move one part to another but not instantly i was trying

for i = 1,10 do
	part1.CFrame = (Part1.CFrame - Part2.CFrame)/10
end

doesn't work :/ anybody got suggestions 4 me?

1 comment

0

use lerp or interpolation

1 answer

✓ Accepted answer

Lerping is a great option for that:

for i = 1,10 do
	part1.CFrame = part1.CFrame:Lerp(Part2.CFrame, i/10)
	wait() -- Don't forget the wait()!
end

Lerping is basically an easier and a simplier way to tween

https://developer.roblox.com/en-us/api-reference/datatype/CFrame (You can find lerp in the properties > functions)

Hope it helped!

2 comments

1

Make sure the part1 is anchored

0

Wow that is so cool I had no idea that existed thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.