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.
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)
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