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

How to add a Delay to a script?

Asked by
bhob12 5
10 years ago

Hey guys, I'm trying to delay something happening but it's not working very well ... can you help me?

5 answers

Log in to vote
0
Answered by
Necrorave 560 Moderation Voter
10 years ago

Try adding "wait()" inside of the script.
-- Place a number within the parenthesis. That number will represent seconds.

Be sure to place it where you want to "Delay" in order to make it work correctly.

0
You should also note that the delay is in seconds. User#2 0 — 10y
0
Ahh, yes. Edit Incoming. Necrorave 560 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

You need to be more specific. Do you mean wait()?

0
He's referring to the wait function, yes. User#2 0 — 10y
Log in to vote
0
Answered by 10 years ago

Delay() can also be used if you wish to use a function after a delay with two arguments (elapsed time, place time). wait() is generally a better way, though, with an argument in seconds for amour of time to wait. wait() can also be used similar to a connection line.

pathway = --put the pathway of whatever item you want to wait for here. Don't include the actual event.
pathway.event:wait()
Log in to vote
0
Answered by
phxtn 154
7 years ago
wait()
Log in to vote
0
Answered by 5 years ago

Be aware that I am not a professional scripter.

It's simple. Here, you can use the wait() function. The number of seconds needed to wait will be put in the parentheses. For example, 0.1 will wait for 100 milliseconds(0.1 seconds).

while true do
    wait(1) --waits for 1 second.
    print("waited 1 second!") --prints into the output.
end

Answer this question