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

How does this coroutine work, and how can you use it? I've seen this a lot!

I've seen this a lot, does anyone know how it works??

function Spawner(func, ...)
   local co = coroutine.wrap(func)
   co(...)
end)

It looks confusing

2 answers

local courotines = coroutine.create(function()

While true do Print(1) Wait() End End()

Coroutine.resume(courotines) While true do Print(2)

End

This would print 1 and 2 at the same time it helps if you wanna do stuff after a loop

1 comment

0

Did not help, or correlate to my question,

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