What happens when two event functions fire at the same time?

I was always wondering what will happen if two event functions simultaneously fire.
Will they be executed in parallel? Or this will create some timing issues and I should use task.spawn() or coroutines?

I know I can figure this out on my own and it seems to be, that they will run together, as if task.spawn() was used. May someone confirm this?

Think they are fired after eachother in the order they were connected.

Functions connected to events are executed in a LIFO (Last-In-First-Out) order from when they were connected, meaning the latest connection is the first to be executed. If connected with RBXScriptSignal:Connect, those functions will be executed asynchronously. If connected with RBXScriptSignal:ConnectParallel, they will be executed in parallel

2 Likes

They will run asynchronously, because when you create a connection, and the event fires, the function appended to the connection will be ran in another thread. So, for example, if player 1 touches a killbrick and player 2 too, player 2 and player 1 would die almost simultaneously

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.