|
| 11 Jul 2016 11:23 AM |
I need some help in coming up with a script that will teleport all players (It's for a minigame) to each individual spawn points, So player 1 will spawn on spawn1 and player 2 would spawn on spawn2 so forth. Any ideas?
Regards.
|
|
|
| Report Abuse |
|
|
|
| 11 Jul 2016 11:38 AM |
local spawns=[pathline to spawns here]:GetChildren() local plrs=game.Players:GetChildren()
if #spawns>=#plrs then for i = 1,#plrs do repeat wait() until plrs[i].Character plrs[i].Character:MoveTo(spawns[i].Position+Vector3.new(0,3,0)) end else print('Not enough spawns for everyone') end
Speedy J. Zoel || Robux: R$1,312 || RAP: R$80,994 |
|
|
| Report Abuse |
|
|
devHoodie
|
  |
| Joined: 04 Nov 2008 |
| Total Posts: 30332 |
|
|
| 11 Jul 2016 11:44 AM |
function TeleportPlayers(SPAWNS) --assuming SPAWNS is a table and #SPAWNS = #PLAYERS for i1,SPAWN in pairs (SPAWNS) do for i2,PLR in pairs (game.Players:GetPlayers()) do if i2 == i1 then local CHAR = PLR.Character or PLR.CharacterAdded:wait() CHAR:MoveTo(SPAWN.Position+Vector3.new(0,3,0)) -- why end end end end
|
|
|
| Report Abuse |
|
|
|
| 11 Jul 2016 11:46 AM |
Spawns are not currently a table, they are individual bricks at different location of the specific minigame.
|
|
|
| Report Abuse |
|
|
|
| 11 Jul 2016 11:46 AM |
@Above Yours is much more inefficient, as it cycles through the players table trying to find a number match.
Speedy J. Zoel || Robux: R$1,312 || RAP: R$80,994 |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2016 02:52 PM |
How would I go about checking which players survived the round?
|
|
|
| Report Abuse |
|
|
| |
|