Using bindable events to communicate 2 server-sided scripts?

Hello everyone! I’m trying to make 2 scripts interact with eachother:

  1. a ProximityPrompt Script which does something when triggered (in this case, sends an event to the other script)

  2. A Script which fills a tank with a cylinder (so that it looks like liquid) and empties it when it is full IF the player used the proximity Prompt.

Any alternatives are also greatly appreciated!
Hierarchy:
Screenshot_2

Liquid Script ( for tank ):


I want to Implement Bindable Event so that, when the server fires an event from CollectScript to Liquid Script, the above action will play.

Collect Script:

And what your issue? Usually you aren’t supposed to ask people to code for you on the developer forums.

Also, you should use ProximityPrompt.Triggered in this case, instead of ProximityPromptService.PromptTriggered, because the latter (ProximityPromtService) fires if ANY proximity prompt is triggered while the former (ProximityPrompt) fires only for the single object.

1 Like

I meant how do I send a Script to Fire something and another script to Connect to it, cause I don’t understand the Bindable Event example in here

Edit: Nevermind I found it, so firing is example:Fire() and the listener is an event function

Just make a bindable event and;

--in the script you want to fire it from
BindableEvent:Fire()

--in the script listening for the bindable event
BindableEvent.Event:Connect(function()
    print("Fired!")
end)

thank you! That’s what I was looking for!