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

Not teleporting everyone?

Asked by 9 years ago

I have tried this

local pos = Vector3.new(-375.863, 97.1, 834.132)
    for _, player in pairs(game:GetService("Players"):GetPlayers()) do
        if player.Character then
            player.Character:MoveTo(pos)
end
end
end

and roblox's suggested one

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
   --Make sure the character exists and its torso exists
   if player.Character and player.Character:FindFirstChild("Torso") then
       --add an offset of 5 for each character
      player.Character.Torso.CFrame = target + Vector3.new(0, i * 5, 0)
   end
end

and they both only teleport one person.. its part of a larger script...this is not the only part.

WHATS GOING ON???? Help if you can.

0
You could possibly try and use Character.Torso in your script. Because the Torso is welded to all body parts, so it will teleport all parts. And when your more specific... Good stuff happens. Grenaderade 525 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago

The script only runs once - as soon as the game starts. There's only one player right when the game starts. I suggest connecting a function to it (and connecting an event to that function); for example:


game.Players.PlayerAdded:connect(function(player) local pos = Vector3.new(-375.863, 97.1, 834.132) --I removed the for loop because this would just teleport the player when they joined. repeat wait() until player.Character player.Character:MoveTo(pos) end end)
0
I just wanna correct your terminology. You suggest putting it in a function, and connecting that function to an event. Perci1 4988 — 9y
0
Right, thanks. Corrected that. dirty_catheter 7 — 9y
Ad
Log in to vote
-1
Answered by 9 years ago
local pos = Vector3.new(-375.863, 97.1, 834.132)
while wait() do
--game stuff
for i,v in pairs(game.Players:GetChildren()) do
v.Character:MoveTo(pos)
end
--other game stuff
end


Answer this question