Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
1

how can i call a function in the same server script and not have to wait for it to finish?

Asked by 4 months ago

i want to call function2 through function1, but function2 has a wait() command in it, but i want function1 to keep going and not have to wait for it, i tried to use remote events but it doesnt work because im using server to server

2 answers

Log in to vote
0
Answered by 4 months ago

Use coroutines.

coroutine.wrap(function()
    -- Your code here
end)()

If you want to give it a name, do this:

local myFunc = coroutine.create(function()

end)

coroutine.resume(myFunc)
Ad
Log in to vote
0
Answered by 4 months ago

Use spawn..

spawn(function()
    -- script
end)
0
on the called function or the caller? cheetahjad -4 — 4mo
0
Spawn is a bad habit. Use coroutines. youtubemasterWOW 2706 — 4mo

Answer this question