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

[SOLVED] I use spawn(function() always, but what is better? coroutine.wrap(f) or spawn(function()?

Although they behave the same, what is the recommended function to use? They said you can call coroutine whenever you want but spawn(function() already executes. I soon replaced some of my codes that have spawn(function() with coroutine.wrap(function() since I am now familiar with it. But still, I am asking if which one of those two is recommended.

3 comments

0

coroutines are recommended to use instead of spawn

2

Spawns are known to have a built- in delay, whilst corountines are recommended to use!

0

Thanks, I know what to use now!

1 answer

✓ Accepted answer

#Coroutines

Coroutines are better to use in several ways

  1. They're more reliable than spawns since they have no delays

  2. They work 99.9% of the time properly

  3. More efficient, easier to use etc

You can also check a documentation on corountines here

They're many more reasons!

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