How to use coroutines with a function inside a module script

oh got it! how do I do it?

coroutine.resume(dmpPlr2(...))

like this?

1 Like

If you’re passing arguments make sure to put the argument names inside of function

That’ll run the coroutine. You can also run it multiple times so you don’t need to create a new one each time.

2 Likes
local dmgPlr2 = coroutine.create(function() skillsModule.damagePlr2(hitbox.Position, hitbox.Size, 10, 0.5, 8) end)
coroutine.resume(dmgPlr2)

I’m using this and it seems to be working, gotta fix some values, but I’m not getting any more errors!

1 Like

i had edited my post above, you can pass arguments directly in the resume function instead of creating a new function for coroutine.create:

1 Like

okay I’m gonna try that, since it’s simpler

1 Like

it doesn’t work for some reason

1 Like