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

Why is it on a last standing round it dosent tell the right winner?

Asked by 9 years ago

So I have been making a mini game and I'm making a last standing round, when it tells the winner it either says the first one to die as the winner or it says nobody wins.

This is to tell if there is one murderer left.

    repeat 
        murderersAlive = 0
        for _,player in ipairs(game.Players:GetChildren()) do
            local isAlive,hum = getStatus(player)
            if isAlive then
                if hum:FindFirstChild("Murderer")~=nil then
                    murderersAlive = murderersAlive +1
                end
            end
        end
        wait(1)
        timeLeft = timeLeft-1
        game.ReplicatedStorage.TimeUpdate:FireAllClients("Time Left: "..tostring(timeLeft))
    until murderersAlive <=0 or murderersAlive == 1 or timeLeft <=0
    print(murderersAlive)

This is to tell who is the winner.

    if murderersAlive > 0 and timeLeft == 0 then
        msg = "LOL NOBODY WINS!"
        endsetting = 1
    elseif murderersAlive == 1 then
        for _,player in ipairs(game.Players:GetChildren()) do
            if player.Active ~= nil and player.Active.Value == "Is Active" then
                winner = player.Name
            end
        end
        msg = winner.." HAS WON MURDER MADNESS!"
        endsetting = 2
    elseif murderersAlive == 0 then
        msg = "LOL NOBODY WINS!"
        endsetting = 3
0
Are there any errors that show up when you runt it? User#9949 0 — 9y
0
No there are not any errors in the output log/developer console. beezer45 0 — 9y

Answer this question