Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to Move to a random spawn?

for i,v in pairs(game.Players:GetPlayers()) do    		v.Character:MoveTo(Workspace.Spawns.Spawn.Position, Workspace.Spawns.Spawn)
end	

Ok so I have a model named "Spawns" with 10 Spawns inside it. This script always picks just one spawn, so after say a timer finishes, ALL the players are moved to 1 spawn in the model. How can i make the players spawn in different areas, as I dont want them all towering on top of each.

1 answer

✓ Accepted answer

If all Spawns have the same name it will be hard, I suggest you to add number them. Another thing, are you using the right MoveTo method? there are two: wiki.roblox.com/index.php?title=MoveTo The one you using makes the character walk, but the other one moves the model. About the script, use a random number:

spawn = game.Workspace.Spawns:FindFirstChild("Spawn" .. tostring(math.random(1, 10)))
for i,v in pairs(game.Players:GetPlayers()) do
	v.Character:MoveTo(spawn.Position)
end

5 comments

0

I'm using the one that tp's the character

1

Not actually. Look the Wiki link, the one with position and part makes the character walk and it's a member of Humanoid.

0

Oh, IDK, I'm not extremely good at scripting. I just use the MoveTo to move players to parts, just never used it more spawns

0

Just read the wiki. By the way, did it work?

0

IDK, I Will test tomorrow, gotta go to bed. If it works I'll be sure to rate up and accept answer

This discussion is preserved as it was. New answers, comments, and votes are closed.