So I'm making a map script, and for all the players, when they enter a map, the each get assigned their own spawn so they don't all stack on one another. Just a simple script as my attempt; tho it didn't get very far :/
wait(5) Plyr = game.Players:GetChildren() -- All Players Spawns = game.Workspace.TreeMap.Spawns:GetChildren() -- All Spawns for i = 1,#Plyr do for x = 1, #Spawns do Plyr[i].Character.Torso.Position = Spawns[x].Position -- Assign Here? each torso gets its own position allocated in the for loop? right? end end
I don't know and I think I have confused myself haha, Any Help much appreciated Thx, ~ Bubs
First, to teleport a player without killing them you need to change the Torso's CFrame, not the position. Also, with your current script, each player is just going to get teleported to EACH spawn point once (because the loops will happen for EACH player).
What this does is it places a player incrementally, placing the players at a new spawn and then just cycling back through the spawns if each spawn gets a player.
wait(5) Plyr = game.Players:GetChildren() -- All Players Spawns = game.Workspace.TreeMap.Spawns:GetChildren() -- All Spawns numSpawn = 1 for i = 1,#Plyr do if numSpawn == #Spawns then Plyr[i].Character.Torso.CFrame = CFrame.new(Spawns[numSpawn].Position) numSpawn = 1 else Plyr[i].Character.Torso.CFrame = CFrame.new(Spawns[numSpawn].Position) numSpawn = numSpawn + 1 end end
Updated, let me know if this works for you!
an easier way out is you could have messed with teams, and make spawn locations and set which team is supposed to spawn to which spawn location by changing the team color properties, please upvote because im trying to be able to chat again :)