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

Is there a way to run a portion of code without yielding the script?

Asked by 7 years ago

Basically what I mean by this is something like this

1local function test()
2    print('abc')
3    wait(1)
4end
5 
6test()
7print('this printed one second after abc assuming server didnt wait longer')

What I want to do is make that second print() occur right after abc is printed while still having the wait in the function

1 answer

Log in to vote
0
Answered by 7 years ago

You cannot remove a yield from a script but you can use spawn or even delay

More infomation can be found on the threading wiki page.

Example:-

1local function test()
2    print('abc')
3    wait(1)
4    print('test end')
5end
6 
7spawn(test)
8print('this printed one second after abc assuming server didnt wait longer')

I hope this helps.

Ad

Answer this question