Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-2

What is the infinity wait() function?

Asked by 10 years ago

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?

0
You want to make it "infinity" but not have it run forever? Please explain. Ekkoh 635 — 10y
0
I want it so the script never re-activates. TheRings0fSaturn 28 — 10y
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. TheRings0fSaturn 28 — 10y
0
Just remove the line where it turns the debounce off. adark 5487 — 10y
0
Alright. Thanks. TheRings0fSaturn 28 — 10y

2 answers

Log in to vote
1
Answered by
Vividex 162
10 years ago

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
0
That explains nothing to me. TheRings0fSaturn 28 — 10y
0
... 'a while loop which runs a code an infinite amount of times' as you can see the word "infinite" Vividex 162 — 10y
Ad
Log in to vote
1
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
10 years ago

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.

Answer this question