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

How do I break a loop?

I really just need to know this ASAP. Here's the script:

wait(0.1)
while true do
	script.Parent.Text = "SAVING"
	wait(0.5)
	script.Parent.Text = "SAVING."
	wait(0.5)
	script.Parent.Text = "SAVING.."
	wait(0.5)
	script.Parent.Text = "SAVING..."
	wait(0.5)
	break(10) -- ERROR: Expected 'end' (to close 'do' at line 2), got '('
end

2 comments

0

What are you intending to do with line 11? Break is a keyword, not a function that you call.

0

Then how do I change it into a keyword?

1 answer

I think this is what you we're intending...

wait(0.1)
while true do
    script.Parent.Text = "SAVING"
    wait(0.5)
    script.Parent.Text = "SAVING."
    wait(0.5)
    script.Parent.Text = "SAVING.."
    wait(0.5)
    script.Parent.Text = "SAVING..."
    wait(0.5)
wait(10)
    break
end

or

wait(0.1)
while wait(10) do
    script.Parent.Text = "SAVING"
    wait(0.5)
    script.Parent.Text = "SAVING."
    wait(0.5)
    script.Parent.Text = "SAVING.."
    wait(0.5)
    script.Parent.Text = "SAVING..."
    wait(0.5)
    break
end

I don't really know what you're doing.

2 comments

0

I figured out a better way to fix my problem. It's a bit complicated. But thank you anyways :)

0

K, you really didn't give us that much information though.

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