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

Script is pausing loops instead of ending them?

Asked by
niroqeo 123
4 years ago

So I have a round based game and if all the players in a team die then it will break the for loop and continue. That's what I want it to do. What it's actually doing is pausing the timer for about 5 seconds and continue. Please help..!

-- the parts that really matter
                for countdown = 300,0, -1 do
    if script.endRound.Value == true then
        script.CountDown.Value = 0
        break
    end
    if game.Workspace.Radio.Activated.Value == true then
        wait(20)
        script.CountDown.Value = 0
        for _, v in pairs(Players:GetChildren()) do
            if v.TeamColor == BrickColor.new("Dark stone grey") then
                v.leaderstats.Cash.Value = v.leaderstats.Cash.Value + 50
            end
        end
        script.CountDown.Value = 0
        break
    end
    for _, v in pairs(Players:GetChildren()) do
        if v.TeamColor ~= BrickColor.new("Dark stone grey") then
            for _, v in pairs(Players:GetChildren()) do
                v:LoadCharacter()
                script.endRound.Value = true
                wait(5)
                script.endRound.Value = false
            end
        end
    end
    script.CountDown.Value = countdown
    wait(1)
end
0
5 seconds? there is something wrong with "wait(5) script.EndRound.Value = false. digameschannel 44 — 4y
0
I'm on my phone right now, but the if statement when it breaks it is really just pausing it until the value is false... Does that make sense? niroqeo 123 — 4y

Answer this question