Her0z
|
  |
| Joined: 04 Apr 2009 |
| Total Posts: 1579 |
|
|
| 21 Jul 2011 06:32 PM |
local players = game.Players:GetChildren() for i = 1, #players do table.insert(alive,players[i]) players[i].Character:MoveTo(Vector3.new(math.random(-107, 107), 98, math.random(-107, 107))) players[i].Character.Humanoid.Died:connect(function() alive[players[i]] = nil print("Player Has Died") end) end print(alive[1],alive[2]) wait(30) print(alive[1],alive[2])
the print wen player dies is Player Has died, but after that (after 30 seconds) the print for the table is still Player nil, i need it to become nil nil when player dies, it seems to skip the alive[players[i]] = nil part |
|
|
| Report Abuse |
|
|
Her0z
|
  |
| Joined: 04 Apr 2009 |
| Total Posts: 1579 |
|
| |
|
|
| 21 Jul 2011 06:49 PM |
| If what I understood was that alive was a table then why don't you use table.remove() ? |
|
|
| Report Abuse |
|
|
Her0z
|
  |
| Joined: 04 Apr 2009 |
| Total Posts: 1579 |
|
|
| 21 Jul 2011 06:55 PM |
| i dont want to remove the table, it will most likely be filled with other players names, not just one, and i want it to remove that players name if they die |
|
|
| Report Abuse |
|
|
Her0z
|
  |
| Joined: 04 Apr 2009 |
| Total Posts: 1579 |
|
|
| 21 Jul 2011 06:58 PM |
| nvm.... i just realized u might be meaning the complete oppisite of what im thinking... tables are annoying... :P, did u mean table.remove(table,players[i]) or did u mean remove all of the table |
|
|
| Report Abuse |
|
|
Her0z
|
  |
| Joined: 04 Apr 2009 |
| Total Posts: 1579 |
|
|
| 21 Jul 2011 07:10 PM |
| bump :P, table.remove(table,value) doesnt work :P |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2011 05:13 AM |
| The first argument is the name of the table and the second is the position of the value you want to remove. |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2011 05:15 AM |
| Try table.remove(alive, i) |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2011 05:20 AM |
alive = {}
local players = game.Players:GetChildren() for i = 1, #players do table.insert(alive,players[i].Name) players[i].Character:MoveTo(Vector3.new(math.random(-107, 107), 98, math.random(-107, 107))) players[i].Character:findFIrstChild("Humanoid").Died:connect(function() table.remove(alive,players[i].Name) print("Player Has Died") end) end print(alive[1],alive[2]) wait(30) print(alive[1],alive[2]) |
|
|
| Report Abuse |
|
|