Parallel Lua crashing the game

I’m trying to optimize a game i’m working on so we thought of using parallel lua. I learned how Parallel lua works and changed the scripts. However i have came across a problem. When ever the events connects (using RBXScriptEvent:ConnectParallel) the game crashes, testplay in studio crashes and disconnects players who are playing the game from the client. I honestly don’t know why is this occurring or what have i done wrong and i really need a solution

Here is the part of the code that uses parallel lua

game.ReplicatedStorage.RemoteEvent.OnServerEvent:ConnectParallel(function(Player, Argument1, Argument2, Argument3, Argument4)
1 Like

The reason why it is crashing is because RemoteEvent.OnServerEvent is currently unsafe to run in parallel.

If something is unsafe to run in parallel, it will error. It you try RBXScriptEvent:ConnectParallel to something that is unsafe, it will crash.

Hope this helps! If you are unsure, look for unsafe. If its unsafe, it will crash.

1 Like

Just a clarification, OnServerEvent being “Unsafe” means you can’t read the property in a parallel thread, not that you can’t use ConnectParallel on it.

The crash happens when you try to read or change something inside the parallel thread that is unsafe, i.e. changing the position of a part. This should be causing an error instead of crashing and isn’t functioning as intended.

3 Likes