Hello. Is there an alternative to BindableEvent which can fire multiple scripts at the same time? I just figured out that only one script can be affected by BindableEvents at a time. So is there a way to get around this?
Thanks
Well, you can use a global variable, _G. Here is a post that explains it pretty well.
"What is _G and for what i can use it?
Hey dabopatiaj!
I don’t think you understand what a BindableEvent truly does. It acts like a normal event but you are communicating between scripts on the same side of the ROBLOX client-server model. When you fire the BindableEvent, all connections that are hooked to .Event on that BindableEvent are fired.
You are incorrect on the fact that it can ‘only fire one script at a time.’
local bindableevent = Instance.new("BindableEvent")
--Script 1
bindableevent:Fire("Hello!")
--Script 2
bindableevent.Event:Connect(function(argument)
print(argument,script)
end)
--Script 3
bindableevent.Event:Connect(function(argument)
print(argument,script)
end)
Ok. I swear that this did not work before I restarted studio. Things like this seem to happen sometimes. Sorry for the inconvenience, and thanks for the help!
Although this is not the source of my problem, it’s very good to know something like this for the future. Thanks for your response.
Well, you asked for alternatives for Bindable Events, therefore I displayed an alternative. Happy to help though.
Yes you did answer my question. Thanks.
from official dev site:
Limitations
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.
Well, too bad wiki is containing wrong or outdated information about this behaviour. If you test it yourself in studio, you will quickly realized that this is not the case, here is a short video of it: