I am working on a map changing script. I can't teleport players to the spawns. I am using a server script so I can't access local player(which would be used to teleport the players' torso).
✓ ANSWER ACCEPTED
How can teleport players to spawn locations?
1 answer
✓ Accepted answer
Well, this is an easy answer. Here it is: So first, what you would do is Get every single player with
for i,v in pairs(game.Players:GetChildren()) do
end
After that, you'd get the character from it.
for i,v in pairs(game.Players:GetChildren()) do
repeat wait() until v.Character ~= nil
end
After this, you can get the Torso from this, and teleport it to the SpawnPoint. ( Being a part or an actual Spawn Point.
for i,v in pairs(game.Players:GetChildren()) do
repeat wait() until v.Character ~= nil
local Character = v.Character
if v.Character.Torso ~= nil then
local Torso = v.Character.Torso
local SpawnPoint = game.Workspace.SpawnPoint
Torso.Position = SpawnPoint.Position
end
end
and there ya have it.
This discussion is preserved as it was. New answers, comments, and votes are closed.
