How to communicate between server scripts?

Odd question, but let’s say I have a datastore script, and a regular gameplay script. I wanna be able to tell the datastore script to do something from the regular gameplay script. Is that possible? Btw I am familiar with remote events, but I don’t think this is the way to go(firing client then fire to datastore).

Are they both server-sided? Then either consider making the data store script a ModuleScript or use a BindableFunction or BindableEvent. Those are your options.

1 Like

Yeah both are server sided. I used module scripts before, but I have never created any. Since they are both regular scripts what am I suppose to do lol. The datastore script is connected as soon as the player joins the game.

Use a BindableEvent then.

Script 1

game.ServerStorage.BindableEvent.Event:Connect(function()
	-- Do stuff
end)

Script 2

game.ServerStorage.BindableEvent:Fire(1,2,3)
1 Like

wait, I never heard of bindable events is it just basically the same as remote events except its communication between scripts?

It’s same-side communication. Server to Server or Client to Client. So, yes, like a Remote but for the same-side instead of boundary communication.

1 Like

That just saves me tons of time thank you bud. Never knew such an event existed.