How do I use a coroutine without a function?

I have a script that is supposed to play some effects if the player has missed a note, but I encountered a problem: the face eventually not changing back to the original one, and that is not what I want. How would I do a coroutine (to prevent the issue) without a function? I don’t actually want to use spawn because I heard that is not good, and I don’t want to make a function and give it a lot of params. Any idea?

you don’t need to give parameters? you can just

coroutine.wrap(function()
    --do stuff
end)();

I know this was already answered but I just wanna say this
If your talking about the good ol’ spawn() function, then there’s task.spawn() or task.defer()
Check out this link for more info
Task Library - Now Available! - Updates / Announcements - DevForum | Roblox

1 Like