#I dont know whats wrong

1 messages · Page 1 of 1 (latest)

fast torrent
#

The problem is that if there are less than two players active and the intermission countdown hits zero it stops and doesnt restart the loop and if u try turning AFK off again nothing happens.

keen barn
#

the line break kills the loop entirely

#

U want the code to not work basically

#

Im not saying that break is bad

#

But not used properly in ur code

fast torrent
#

then what do i use instead to send it back to the start of the loop?

keen barn
#

continue

#

Also i remade the code

#

local function Round()
while true do
inRound.Value = false

    for i = intermission, 0, -1 do
        status.Value = "game will start in "..i.." seconds"
        task.wait(1)
    end

    local activePlayers = #game.Players:GetPlayers() - #game:GetService("CollectionService"):GetTagged("AFK")

    if activePlayers < 2 then
        status.Value = "Not enough players"
        task.wait(2)
        continue
    end

    inRound.Value = true

    for i = roundlength, 0, -1 do
        local playing = {}
        for _, plr in pairs(game.Players:GetPlayers()) do
            if plr.Team.Name == "Players" then
                table.insert(playing, plr.Name)
            end
        end

        if #playing == 0 then
            status.Value = "Everyone has died"
            task.wait(3)
            break
        end

        if #playing == 1 then
            status.Value = playing[1].." has won"
            task.wait(3)
            break
        end

        status.Value = "game will end in "..i.." seconds"
        task.wait(1)
    end
end

end

task.spawn(Round)

#

Try this