Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

What am I doing wrong with this loop?

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

This discussion is preserved as it was. New answers, comments, and votes are closed.