Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to teleport players? [closed]

Asked by 6 years ago

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!

Closed as Not Constructive by Goulstem

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
1
Answered by 6 years ago

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
0
No, as that makes the player walk to it. CFraming the head makes the player teleport to it. hiimgoodpack 2009 — 6y
0
Using `MoveTo` on the actual Humanoid object makes them walk.. Using on the Model will move it. Goulstem 8144 — 6y
0
"CFrame" equivalent to `MoveTo` would be `SetPrimaryPartCFrame` Goulstem 8144 — 6y
Ad