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

I cant break out of this repeat loop to get to the ending script that prints "end of game"?

Asked by 4 years ago
Edited 4 years ago

This is my zombie wave that repeats until all players have died, however once they all died it stops the time and gets stuck,it does not print ("end of game")

repeat wait()

    for i = GameLength,0,-1 do

        Status.Value = ""..i.." seconds ramaining, "

        if zombiesAlive.Value == 0 then
            zombieCount.Value = 6 * wave.Value
            zombiesAlive.Value = 6 * wave.Value
        end

        if #plrs == 0 then 
            -- Last person standing
            gameInProgress = false
            Status.Value = "The winner is "..plrs[1].Name
            plrs[1].leaderstats.Points.Value = plrs[1].leaderstats.Points.Value + reward
            break

        elseif i == 0 then
            Status.Value = "The winner is "
            wave.Value = wave.Value + 1
            for i, player in pairs(game.Players:GetPlayers()) do
                ingame = player:FindFirstChild("ingame")
                if ingame then
                    if ingame.Value == true then
                    player.leaderstats.Points.Value = player.leaderstats.Points.Value + 50
                    end
                end

            end
            break
        end
        wait(1)
    end

    until gameInProgress == false or #plrs == 0
    if gameInProgress == false then break end

    wave.value = 0 
    print("End of game")
    ClonedMap:Destroy()
    Status.Value = "Game Ended"
    wait(2)

end

0
Try putting the break in the "Repeat loop" and not in the for loop. Breaks can be only used once. SoftlockedUnderZero 668 — 4y
0
This looks similar to an AlvinBlox script... ShutokouBattle 227 — 4y

Answer this question