Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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)

Use spawn..

spawn(function()
	-- script
end)

2 comments

0

on the called function or the caller?

0

Spawn is a bad habit. Use coroutines.

This discussion is preserved as it was. New answers, comments, and votes are closed.