Whats the best way to connect 2 scripts?

I am trying to connect 2 server scripts together, so when one script is finished, the other one runs. I want to do this for organization reasons, and i don’t know what the best way to do it is.

1 Like

You could use BindableEvents, keep in mind that these can not cross over the server-client boundary. If you fire the event on the server, you need to have it connected on the server, the same with the client. Just fire the event when all other code is done, which would need to be decided by you.


You could put a function A in a ModuleScript, function B in a module script, and call them both in a server Script:

--- module A
return function DoSomethingFirst()
-- module B
return function DoSomethingSecond()
  print("something else")
-- server script that ties them together
local DoSomethingFirst = require(game.ReplicatedStorage.ModuleA)
local DoSomethingSecond = require(game.ReplicatedStorage.ModuleB)

1 Like