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

So apparently this loop is not working, do any of you know why? It's a loop centered around colors.

repeat wait(1) until Term.BrickColor == BrickColor.new("Navy blue")
	if TUW <= 1200 and TUW > 0 then
		TUW = TUW - 1
		print(TUW)
		script.Parent.CT.Text = tostring(TUW)

1 answer

You're not understanding how a repeat loop works.

repeat
	--// This is what loops.
until (condition)

A repeat loops is a lot like a while loop, except a while loop checks the condition first, while as a repeat loop checks its condition last.

This answer will help you understand them more.

I'm not sure what this code is even suppose to do, but you're missing an end, and that's basically all the syntax errors fixed.

repeat 
	wait(1) 
until Term.BrickColor == BrickColor.new("Navy blue")

if TUW <= 1200 and TUW > 0 then
	TUW = TUW - 1
	print(TUW)
	script.Parent.CT.Text = tostring(TUW)
end

If I were to guess I would say you meant to include your conditional statement in the loop:

repeat 

	if TUW <= 1200 and TUW > 0 then
		TUW = TUW - 1
		print(TUW)
		script.Parent.CT.Text = tostring(TUW)
	end

	wait(1) 
until Term.BrickColor == BrickColor.new("Navy blue")

print("Done")

If this isn't the answer you were looking for, please explain more what it is you're trying to do.

More Info.

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