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

What am I doing wrong with this loop?

Asked by 8 years ago

Here is the code:

win = 300
while true do
    wait()
    if script.Parent.BrickColor == BrickColor.new(raidteamcolor) then
        repeat      
        win = win - 1
        value.Value = "Raiders will win in".." "..win
        wait(1)
        if script.Parent.BrickColor == BrickColor.new(defendteamcolor) then break end
        if win ==-1 then break end
        until
        win==0
    elseif script.Parent.BrickColor == BrickColor.new(defendteamcolor) then
        repeat      
        win = win + 1
        value.Value = "Defenders have taken back the base".." "..win
        wait(1)
        if script.Parent.BrickColor == BrickColor.new(raidteamcolor) then break end
        if win==301 then break end
        until
        win==300
        end
    end

So when win == 301, it does not stop adding. If I put "if win==301 the break end" under the until, when the other team steps on the brick it will not restart the count down for the raiding team. Can anyone help me with this. If you need more information please ask below.

1 answer

Log in to vote
0
Answered by 8 years ago

if win == 301 then return end()

Ad

Answer this question