Control the Order of Server Script Execution

How do I go about controlling the order in which Server Scripts are executed?
I want to break up long processes into relevant chunks of Scripts but some of them may be dependent upon other scripts having had run prior to its execution.

How can I ensure that any given script has been executed before beginning the execution of the next script? This is specifically for server scripts but being able to do this client side would be very helpful as well.

1 Like

You could create another script that enables the other scripts accordingly or you could use BindableEvents to tell a script to execute after one is done, then tell another script to execute after… (e.t.c…) Personally, i recommend the BindableEvent method as it’s more reliable. (I’m pretty sure you can use BindableEvents in localscript to localscript communication)

You could try moving your chunks of code into ModuleScripts and requiring them in the order that you need them to run.

1 Like

Both of those are great suggestions but I think the modules method is what would be more elegant for what I’m doing. I didn’t think about requiring causing them to execute in order. That’s pretty smart.

1 Like