Wait for sever-side scripts to load

Hello,

While working on roblox studio, I encountered a problem related to the order of execution of scripts server sided.
I needed a script to wait for a signal with a bindableEvent sent by another script. However, half of the time, nothing happen because the script receiving the signal hasn’t connected the BindableEvent yet, because of the random loading order of the scripts.

My question is : is it possible to make server-scripts wait until all of them are loaded.
If it isn’t possible, then is it possible to prioritise a script against all of the others.
Or even manipulate the execution order.

Thank you

1 Like

Usually I just have a waitforchild at the top as if 1 script loads then most of them are but if you want to be sure just add a waitforchild anyway

2 Likes

It seems working ! Thanks a lot ! But is there now a way to be sure that one script will run first, like a module script which will wait for all the others script to load ? I know require make the module script load but I don’t want to repeat myself and put require at the beggining of each scripts.

You have no way of controlling which script runs first unless it is a module script however adding in waits and checks will mean it won’t run anything until the certain things have loaded

2 Likes

You mark his reply as the solution if it was the reply that gave you the knowledge to fix your problem.

Sorry, I missclicked multiple times when selecting the solution, roblox didn’t modified the one I selected because you can’t perform too many operations in a small laps of time.

Excuse me

1 Like

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