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

How to teleport players?

Hello, i need a script for teleporting players to different coords (for example i want to teleport 8 players in their cars so they can start racing and i am an absoluete noob at scripting) Thank you very much if you help!

1 answer

You should do this. I will leave comments everywhere explaining stuff.

local teleportpos = CFrame.new(0, 0, 0) --Insert the position where you want them to be teleported.
--I recommend putting the code in front in a function, so it will run multiple times.

for i, v in pairs(game.Players:GetChildren()) do
	v.Head.CFrame = teleportpos --What this does, is that it moves the head. The rest of the body follows the head, so we don't have to manually move the rest too. Also, other people like moving the torso, but R15 have 2 torsos so I like using the head.
end

4 comments

0

No, as that makes the player walk to it. CFraming the head makes the player teleport to it.

0

Using MoveTo on the actual Humanoid object makes them walk.. Using on the Model will move it.

0

"CFrame" equivalent to MoveTo would be SetPrimaryPartCFrame

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