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

What is the infinity wait() function?

I am making a script currently, and it has debounce, but I don't want the script to run again. How would I make it so it's infinity?

5 comments

0

You want to make it "infinity" but not have it run forever? Please explain.

0

I want it so the script never re-activates.

0

At the end of my script there is "wait(9999999) debounce = false." I want it so I don't have to put in the large number, it just waits for infinity to turn the debounce off.

0

Just remove the line where it turns the debounce off.

0

Alright. Thanks.

2 answers

Use a while loop, which runs a code an infinite amount of times unless you use "break" etc.

while true do
	--code
 wait() --I would put a wait at the end of every loop in case it doesnt crash.
end

2 comments

0

That explains nothing to me.

0

... 'a while loop which runs a code an infinite amount of times' as you can see the word "infinite"

As long as you don't write in any loops or connect any functions to repeatable events, the code inside a Lua will only execute once every time it is made un-Disabled (including when the game first loads).

You don't need to add any sort of wait to the end of it.

If you want to escape an infinite loop, use the break keyword.

If you want to escape a function, use the return keyword.

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