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

How to Move to a random spawn?

Asked by 10 years ago
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

Log in to vote
0
Answered by
Tesouro 407 Moderation Voter
10 years ago

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
0
I'm using the one that tp's the character NinjoOnline 1146 — 10y
1
Not actually. Look the Wiki link, the one with position and part makes the character walk and it's a member of Humanoid. Tesouro 407 — 10y
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 NinjoOnline 1146 — 10y
0
Just read the wiki. By the way, did it work? Tesouro 407 — 10y
0
IDK, I Will test tomorrow, gotta go to bed. If it works I'll be sure to rate up and accept answer NinjoOnline 1146 — 10y
Ad

Answer this question