anth4321
|
  |
| Joined: 22 Sep 2009 |
| Total Posts: 29 |
|
|
| 03 Mar 2014 08:45 PM |
spawns = _G.pickedMap.Spawns:GetChildren() -- Optimize math.random math.randomseed(tick()) -- Catch all players players = game:GetService("Players"):GetPlayers() -- Do the following 24 times for i=1,100 do -- Function is useless, if the table is clear if #players==0 then break end -- Choose player and Position local current = math.random(1,#players) local position = spawns[math.random()].Position -- Teleport Players if players[current] and players[current].Character then players[current].Character:MoveTo(position) players[current].GameStats.Alive.Value = true end wait() end
no output |
|
|
| Report Abuse |
|
|
anth4321
|
  |
| Joined: 22 Sep 2009 |
| Total Posts: 29 |
|
| |
|
anth4321
|
  |
| Joined: 22 Sep 2009 |
| Total Posts: 29 |
|
|
| 04 Mar 2014 08:21 AM |
okay sorry there was an output. here it is: 09:19:34.512 - Workspace.Main:92: attempt to index field '?' (a nil value) 09:19:34.513 - Script 'Workspace.Main', Line 92 - global teleplayers 09:19:34.513 - Script 'Workspace.Main', Line 199 - global PickMap 09:19:34.514 - Script 'Workspace.Main', Line 245 - global pickplayers 09:19:34.514 - Script 'Workspace.Main', Line 248 09:19:34.515 - stack
line 92 is: local position = spawns[math.random()].Position |
|
|
| Report Abuse |
|
|
jd678
|
  |
| Joined: 18 Apr 2008 |
| Total Posts: 11529 |
|
|
| 04 Mar 2014 08:45 AM |
local current = game.Players:FindFirstChild(players[math.random (1,#players)]) |
|
|
| Report Abuse |
|
|
anth4321
|
  |
| Joined: 22 Sep 2009 |
| Total Posts: 29 |
|
|
| 04 Mar 2014 09:30 AM |
still gives this error: 10:29:50.941 - Workspace.Main:92: attempt to index field '?' (a nil value) 10:29:50.941 - Script 'Workspace.Main', Line 92 - global teleplayers 10:29:50.942 - Script 'Workspace.Main', Line 199 - global PickMap 10:29:50.942 - Script 'Workspace.Main', Line 245 - global pickplayers 10:29:50.943 - Script 'Workspace.Main', Line 248 10:29:50.943 - stack end |
|
|
| Report Abuse |
|
|
jd678
|
  |
| Joined: 18 Apr 2008 |
| Total Posts: 11529 |
|
|
| 04 Mar 2014 11:28 AM |
| Probably because your script is full of errors and you need to learn how tables work. |
|
|
| Report Abuse |
|
|
Vexedly
|
  |
| Joined: 15 Sep 2006 |
| Total Posts: 7011 |
|
| |
|
jd678
|
  |
| Joined: 18 Apr 2008 |
| Total Posts: 11529 |
|
|
| 04 Mar 2014 11:34 AM |
spawns = _G.pickedMap.Spawns:GetChildren() -- Optimize math.random math.randomseed(tick()) -- Catch all players players = game:GetService ("Players"):GetPlayers() -- Do the following 24 times for i=1,100 do -- Function is useless, if the table is clear if #players==0 then break end -- Choose player and Position local current = game.Players:FindFirstChild(players[math.random(1, #players)]) local position = _G.pickedMap.Spawns:FindFirstChild(spawns[math.random(1, #spawns)]).Position -- Teleport Players if current and current.Character then current.Character:MoveTo (position) current.GameStats.Alive.Value = true end wait() end |
|
|
| Report Abuse |
|
|
anth4321
|
  |
| Joined: 22 Sep 2009 |
| Total Posts: 29 |
|
|
| 04 Mar 2014 08:12 PM |
still doesn't work and the problem is at this line: local position = spawns[math.random()].Position p.s. I know scripting |
|
|
| Report Abuse |
|
|
jd678
|
  |
| Joined: 18 Apr 2008 |
| Total Posts: 11529 |
|
|
| 04 Mar 2014 09:37 PM |
| I fixed that line, and you obviously don't. |
|
|
| Report Abuse |
|
|