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

How would I teleport something to a part?

So when and event occurs

game.Workspace.part

Will teleport to

game.workspace.part2

1 answer

✓ Accepted answer

A number of possibilities should be obvious to you.

Every part has a Position. A simple comparison can have your teleport just like that.

game.Workspace.part.Position = game.Workspace.part2.Position

However, this will account for part boundaries and apply accordingly. If you want the exact coordinates to work with - or want the part to be the exact same place the other is - you would use .CFrame instead. CFrame accounts for the Rotation matrices as well. You could simply add a Vector3 value to it to get it where you want.

game.Workspace.part.CFramew = game.Workspace.part2.CFrame
								   + Vector3.new(0, 4, 0)

Another method you may know of is :MoveTo()

game.Workspace.part:MoveTo(game.Workspace.part2.Position)

You must use position here. You can convert a CFrame to a position by iterating to it with .p

game.Workspace.part:MoveTo(game.Workspace.part2.CFrame.p)

There are probably even more out there, but that's just about all you'd need!

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