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

How can you break or stop a for loop or a while loop?

Hello I have a start button that will start a while loop. And I also have a stop button and I want to stop the loop. How can I do that? I can change it to a for loop if it is impossible to stop a while loop. Thanks

1 comment

1

Please do some research on loops.

2 answers

✓ Accepted answer

You could use this example

while true do
	print("Test")
	break
end

i know that break breaks a while loop. not sure for loops tho.

while true do -- Loop
	break -- Command to break loop
end

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