How do you break a "while true do" loop? (Loops in general, no specific script)

I am not good at scripting though, begginer at best

Use the break keyword, like so:

local a = 1

while true do
    task.wait(2)

    if a >= 2 then
        break -- This breaks any loop.
    end

    a += 1
end
2 Likes

Use the break keyword. It’s like return for loops.

Edit: I got ninja’d

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.