What I'm trying to do is that for every single player it's going to run through a series of checks, and if they are dead or they left the game they are counted as not alive and then they are removed from a table.
for x,v in pairs(plrs) do if v then local Character = v.Character if not Character then table.remove(AlivePlayers,x) else if Character:FindFirstChild("Alive").Value then print(Character.Name.." is still alive.") else table.remove(AlivePlayers,x) end end else table.remove(AlivePlayers,x) end end
I believe, I may not be correct, go easy... But I believe your issue lies on line 07 your if statement hasn't specified exactly what you're hoping 'Alive
' is to equal, sometimes silent outputs consist of synax related problems, honestly if this statement was to run, It wouldn't matter what it equals, as long as Alive
is equal to what it is, go through with it. So I suggest writing it like so
01 for Placement,Players in ipairs(plrs) do if v them local Character = Player.Character or Player.CharacterAdded:wait() --// more efficient if not Character then table.remove(AlivePlayers,Placement) else if Character:FindFirstChild("Alive").Value ~= false then print("'"..Player.Name.."' is still alive.") else table.remove(AlivePlayers, Player, Placement) end end else table.remove(AlivePlayers, Player, Placement) end end
You may have noticed I've spruced it up just a bit, some more efficient methods, like ipairs
.
I also may not exactly be an expert at table looping, yet I believe the second argument of the table consists of the instance, not the index, the third is also an optional choice, if not, then just revert it, or try switching 'Placement
' to Player
instead?
Hope this works, again go easy on me, if everything works out, don't forget to acept the answer and upvote, help me help you:)