How to detect when FireAllClients finishes the function

I’m currently trying to make a tutorial cutscene, however, I have no idea how long it’ll last as it depends all on what I’m doing the cutscene for.

I’d need to find a way to know when FireAllClients finishes, a callback, or something. I looked into using RemoteFunctions instead of RemoteEvents, but unfortunately, there is no InvokeAllClients. The reason why I need to use FireAllClients() is because then everyone experiences the cutscene at once.

If I were to make a for loop on all the players and then run the InvokeClient() on each player, the cutscene would happen separately. So I’m at a big roadblock.

I just need to find a way to know when the function that happens when FireAllClients() is called, or a way to make all InvokeClient()'s happening at once.

I considered a coroutine, but having 12 of those seems like it wouldn’t be the best idea.

You can use spawn() instead of coroutine which is almost the same thing.

for _, player in pairs(game.Players:GetPlayers()) do
        RemoteFunction:InvokeClient(player, args)
1 Like

Is it better to use than coroutine? What’s the difference between the two?

Spawn() is just coroutine with a wait() at the start, it won’t help you in this case.

1 Like

spawn will not be executed right away while coroutine will. coroutines can be useful if you don’t want a certain task to be executed right away. There isn’t a huge difference between the two. You can read more info in this post made by another member.

1 Like

Is having multiple courotines/spawns a bad thing?

You can fire the event again from the client to inform the server that it finished the cutscene on that client.


As far as I know, you should avoid having too many coroutines since they are basically creating new threads in a script and having many threads won’t be very efficient.


I see. Do you think this would be better than having 12 courotines or spawns?

I would choose spawn over coroutines. (I just realised you were asking @BenMactavsin, oops)

Why would you choose spawn over coroutines?

And it’s okay haha. The more knowledge the better

As I said, having too many threads created by coroutines won’t be very memory efficient. And in my opinion, spawn is easier to use than coroutines.

1 Like

I see. Thank you so much for the help! I wish I could mark a solution for both of your guys’ replies lol

1 Like

I am glad I helped! :slight_smile:

1 Like

coroutine is recommended over spawn() because spawn() is a hold-over from roblox’s old 30hz pipeline.

1 Like