I'm basically trying to make a game; a round based game; and I want to check if all the players in the game are dead, so that the game can end if all the players are dead and not just waiting for the round to end. But also, there's a player that's the "craze" who has to kill all players before they escape, so is there a way I can check if all the players are dead except the craze? I have the craze stored as the variable "craze" just in case you need that reference. This is where I'm trying to check if all the players except the craze are dead;
for i = gametime, 0, -1 do status.Value = "Round In Progress (01:" .. i .. ")" if i < 10 then status.Value = "Round In Progress (01:0" .. i .. ")" end wait(1) end
function checkPlayers() for _,v in pairs(game.Players:children()) do if v ~= craze then -- assuming craze is equal to the player if v.Character and v.Character:findFirstChild("Humanoid") then if v.Character:findFirstChild("Humanoid").Health == 0 then return true end end end end end
Try that.
for _, v in pairs(game.Players:GetPlayers()) do v.Character.Died:Connect(function() -- run code end) end