Why isn't this working?
So what I want it to do is then a player in _G.Survivors dies it removes them. The problem with this is when the _G.Survivors[1] player dies it removes everyone from the table. Here's my code:
03 | for a,b in pairs (game.Players:GetChildren()) do |
04 | table.insert(_G.Survivors,b) |
05 | local id = Instance.new( "IntValue" ,b) |
09 | for a,b in pairs (game.Players:GetChildren()) do |
10 | coroutine.resume(coroutine.create( function () |
12 | if b.Character:FindFirstChild( "Survivor" ) then |
13 | if b.Character.Humanoid.Health = = 0 then |
21 | function survivorDied(p) |
22 | for a,b in pairs (_G.Survivors) do |
24 | if p.Name = = b.Name then |
25 | table.remove(_G.Survivors,a) |
Thanks!