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

How do you teleport(All) players?

Asked by 10 years ago

I don't know how... Do you have to use BodyPosition? Or Cframe? I'm confused... I'm using

local player = game.Players:GetPlayers()
for i = 1, #player do
player[i].Character:MoveTo(Vector3.new(0,2,0))

Is it right? I know it's right but Why is it only teleporting one person? Not all the players? Also, why is the game working in Studio but not in actual gameplay? It said here that you might need to do localscript but I tried it but It never worked.

4 answers

Log in to vote
-2
Answered by 9 years ago
Ad
Log in to vote
3
Answered by 10 years ago

Hey there what I would do in your case is use this efficient script found in the Roblox Wiki

wait(30)--Can be any other time
target = CFrame.new(0, 50, 0) --could be near a brick or in a new area
for i, player in ipairs(game.Players:GetChildren()) do
    player.Character.Torso.CFrame = target + Vector3.new(0, i * 5, 0)
    --add an offset of 5 for each character
end

If you want to learn more about teleportation check this link: http://wiki.roblox.com/index.php?title=Teleportation

0
it does not work anymore (for my script anyway) codingMASTER398 52 — 5y
Log in to vote
1
Answered by
Ekkoh 635 Moderation Voter
10 years ago

You could make your own function :3

function teleAll(x, y, z)
    local pos = Vector3.new(x, y, z)
    for _, plr in pairs(Game:GetService("Players"):GetPlayers()) do
        if plr.Character then
            plr.Character:MoveTo(pos)
        end
    end
end

teleAll(0, 2, 0)
0
thank you EpicAshtonTheBoy 33 — 6y
0
it worked thanks :D Yuuwa0519 197 — 5y
Log in to vote
0
Answered by
Link43758 175
10 years ago

It looks like you've forgot an end. Here's the fixed code:

local player = game.Players:GetPlayers()
for i = 1, #player do
player[i].Character:MoveTo(Vector3.new(0,2,0))
end

Hope I've helped! If this doesn't work, just comment and I'll be glad to help.

1
Oh sorry... I didn't post the whole script... EzraNehemiah_TF2 3552 — 10y

Answer this question