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

1 Like

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
4 Likes

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

Edit: I got ninja’d

5 Likes

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