How can a Server Script communicate to another Server Script?

just create a bindableevent, place it somewhere you can access it, such as replicatedstorage, then you can add a variable referencing the bindableevent, then you could use the example provided above.

Baseplate.rbxl (18.5 KB) this is an example implementation.

Are bindable events like replicated events where you can fire them and then the other script knows that it has been fired?

I dont really understand how would you like fire them?

You call BindableEvent:Fire(arg, ...)

image

to invoke BindableEvent.Event.

Just to be clearer those numbers are the arguments I’m supplying to be used as parameters within the callback, which here is print.

Do you need to use those numbers to fire it or not. Because in my case, I dont need that I just need it to know when everyone dies and when the match starts.

function callback( a, b, c )

end
BindableEvent.Event:Connect( callback )

BindableEvent:Fire( a, b, c )

If you don’t need arguments then you just wouldn’t supply anything in the parentheses.

function startMatch()

end
BindableEvent.Event:Connect( startMatch )

-- in your main script,
BindableEvent:Fire()
1 Like

Those numbers are just extra parameters he’s passing into the event, if you want the script that fires the event to be able to pass information to the script that is listening for the event, you’d have to do something like that.

-- Script 1
Bindableevent:Fire( "Hello!" )

-- Script 2
Bindableevent.Event:Connect(function(Message)
    print(Message) -- It would print Hello!
end)
2 Likes

Why not take a look at the documentation? It has explanations, lists of methods, and example code.

I dont think it would need to send info because it just needs to know when the match starts and it will be programmed so that when it received the match start event it knows that the match has started. same thing for when there are no players. Tell me if im wrong though.

Its fine I mostly understand now but thanks for the help anyway.

Yeah, so in your case you wouldn’t have the need to send any extra parameters.

Ok so thanks a lot then. I will make it do that. And test if it works.

But do I do it like this?
Bindableevent:Fire()
or like this?
Bindableevent:Fire

You call the method like you’re supposed to normally

obj:func()

What? What is that? I am confused and I need to be un-confused.

Fire is a method, you use it just like you would any other method, which means you’re meant to put parentheses after it

Oh ok but can I do it like this (As an example)?
script 1:
Bindableevent = game.ReplicatedStorage.TheEvent
function
Bindableevent:Fire
end

script 2
Bindableevent = game.ReplicatedStorage.TheEvent
Bindableevent.Event:Connect(function()
–do stuff
end)

Hello? Can you help me? I have posted something…

Please help me! I really need help!

What do you need help with? (30 charrss)