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

IS IT POSSIBLE TO STOP A LOOP? with a line like return or something?

So I have while true do scripts and also for i = x, x, x scripts. How would I put an end to the loop if a condition is met?

like if there's a number value that reaches a certain number the loop stops? Please help.

If its possible i would like a example.

3 answers

✓ Accepted answer

break breaks your loops.

local potato = 1


while true do
	potato = potato + 1
	
	if potato == 10 then
		break
	end
end

2 comments

0

does break, breaks sit perm?

0

Yes. the Break statement basicly continues the current thread to the end of the closest loop.

break breaks a loop, iterator, or function.

It has to be lower-case by the way.

break

return does end a function but not for loops, it's just used for returning a value.

Every loop has some sort of an [ending]

This would lead you to the case; how do i stop this? Well, as i said, loops has an ending to it. In several scenarios, one may understand the difficulty of leading loops to its very last point, the greatest way of stopping loops such as a while loop or a for loop to name a few is by simply using the 5-lettered word:

break

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