Wait for function to finish

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Remixful

Supporter
Mar 28, 2017
8
0
0
Code:
on script load:
    loop 3 times:
        foo()
        broadcast "2 seconds should've passed"
   
function foo():
    wait 2 seconds
    broadcast "2 seconds have passed"

output:
2 seconds should've passed
2 seconds should've passed
(2 seconds later....)
2 seconds have passed
2 seconds have passed

I would like the loop to wait for foo() to finish running before continuing. Is there a way to achieve this?
 
Last edited:
You can do this using skript-mirrors custom effects. You have to add `delay the effect` before a delay and `continue` when you want the code to continue
 
Status
Not open for further replies.