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

How do i make it disable when everyone is dead

Asked by 10 years ago
local rp = gt[math.random(1,#gt)]
local gt = game.Players:GetPlayers()


for _,Player in pairs(gt) do -- For all the players
   if not Player == rp then -- If player is not the randomly selected player
       if Player.Humanoid ~= 0 then --what im trying to do is if all the players are dead then it will restart the script...
            h.Text = "NOOOOO "          
            script.Archivable = false
            script.Disabled = true
            wait()
            script.Disabled = false
            script.Archivable = true    
        end
    end
end

but it doesnt seems to work, so i'd hope one of you guys could try helping me

1 answer

Log in to vote
0
Answered by
Azarth 3141 Moderation Voter Community Moderator
10 years ago

local gt = game.Players:GetPlayers() --You had rp, before gt was defined. local rp = gt[math.random(1,#gt)] local function findAll() for _,Player in pairs(gt) do -- For all the players when the script first grabbed them. if Player ~= rp then -- If player is not the randomly selected player if Player.Character.Humanoid.Health ~= 0 then -- return true end end end return false end --This should be run every time someone dies, via something like your leaderboard script. if findAll() then print("Someone is still alive.") else print("Everyone is dead") h.Text = "NOOOOO " --This is very bad vvvv script.Archivable = false script.Disabled = true wait() script.Disabled = false script.Archivable = true end
0
However, it is important to know that if their humanoid is removed, or they respawn, this script will not function as expected. Articulating 1335 — 10y
0
hmmh, its not working -.- markus6 5 — 10y
Ad

Answer this question