How to make a script wait before proceeding

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By GameDevDuck


I am trying to make a script pause before continuing (similar to the “wait()” function in Roblox Lua) but I cannot figure it out. I was directed to the Timer node but the problem with this is that I do not want to call a function when the time is over, I just want to continue the script.

Any help would be appreciated!

:bust_in_silhouette: Reply From: timothybrentwood

Just yield() for the Timer’s timeout signal:

yield(my_timer, "timeout")
# rest of code to execute here

It’s not recommended that you do this inside of _process() or _physics_process().