I have a Bindable event that has multiple listeners from multiple scripts. However, I understand that one script can only subscribe to the bindable event as mentioned here. What are some workarounds?
I’m pretty sure multiple scripts can listen to the BindableEvent.Event
event without other RBXScriptConnections getting disconnected.
This is incorrect. As soon as another script subscribes to that event, the first one gets unsubscribed.
2 options:
- Write a handler that subscribes to the event once and allows functions to be called within that subscription
- Change your architecture (probably most recommendable) as this is probably a design mistake
Wiki:
Subscription
An event can only be subscribed to by one other script at a time. When a second script subscribes to an already subscribed event, the first script will be unsubscribed.
The wiki is wrong or possibly meant BindableFunctions. You can have multiple scripts listen to the same bindable’s event just fine, in fact I recall helping a person who had issues because of accidentally connecting to the same bindable in multiple scripts.
That is really strange and very misleading from the wiki. I am either missing something or the wiki is just incorrect.
If you test it yourself in studio, you will notice that’s not the case.