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

Why isn't this working?

Asked by 10 years ago

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:

01_G.Survivors = {}
02 
03for a,b in pairs(game.Players:GetChildren()) do
04    table.insert(_G.Survivors,b)
05    local id = Instance.new("IntValue",b)
06    id.Name = "Survivor" -- Just to mark that the player is a survivor
07end
08 
09for a,b in pairs(game.Players:GetChildren()) do
10    coroutine.resume(coroutine.create(function()
11        while wait() do
12            if b.Character:FindFirstChild("Survivor") then
13                if b.Character.Humanoid.Health == 0 then
14                    survivorDied(b)
15                end
View all 28 lines...

Thanks!

Answer this question