I would like to be able to end a while true loop by using a ClickDetector button but I am unsure how. Any help would be appreciated.
COMMUNITY QUESTION
How can I end a loop using a ClickDetector button?
2 answers
while whatever do
--do your loop code
if clickdetector.mouseclick then
break
else
continue
end
end
matiss is correct, but it is a bit off. This is more how it should be.
while condition do
--loop code
ClickDetector.MouseClick:Connect(function()
break
end)
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
or any other loop, the break part is what you want