BindableEvents seems confusing to me when I read it out on the Roblox API Reference, Does anyone have a more clear idea of what BindableEvents are and how do they work?
In one script you do this
--Bindable event shortened by API
local be : BindableEvent = script.Parent
-- Define a simple function to connect
-- to the custom event
local function onEvent(...)
print(...)
end
be.Event:Connect(onEvent)
Then in another script server-server or client-client you can execute that function
--in script 2
local be : BindableEvent = script.Parent
be:Fire("Hello, world") -- prints Hello World
That’s the main gist of it.
Took the sample code from the API reference.
Bindables allow two or more scripts to communicate.
There are BindableEvents and BindableFunctions, they do the same thing but they’re different in how they behave. They are very well documented on the DevHub.
Another undocumented use of Bindables is the ability to cross VMs (assuming the VMs are synchronised which can be done with the coroutine library), even if they have different identity levels. This will be very important when Parallel Luau exists since state wont be shared between the VMs
This isn’t that helpful to me, as It confuses me a lot as I said.
This isn’t helpful because I said it is confused to break down and understand for me.
Simplest term:
It allows LuaSourceContainer to communicate with each other (assuming they can access the bindable instance), therr are 2 bindable instances, BindableEvent and BindablrFunction.
BindableEvent acts like normal events, there are .Event property (returns RBXScriptSignal) and a :Fire(… : any) method.
BindableFunction acts similarly except when fired it waits for a return from the event callback
Idk what LuaSourceContainer and RBXScriptSignal is at all
That also seems confusing
Yes. So instead of firing to the localscript then the script again you can use this; fire to scirpt to script instead of script to localscript to script.
(This could be totally incorrect)
LuaSourceContainer are scripts, it’s the abstract (base/superclass) of scripts (LocalScript, Script, ModuleScript, CoreScript), RBXScriptEvent is simply an event (most things like PlayerAdded, CharacterAdded, etc returns RBXScriptEvent which then you can do call :Connect() or :Wait() )
Do you know remote events? It’s like that but you use bindable functions/events to communicate with scripts of the same thing.
Basically, if you want to make a server script do stuff with another server script or local script do stuff with another local script use a bindable event/function, with local scripts and server scripts use remote events/functions.
Bindable events can have multiple receiving scripts according to my tests.
So, i made a scene where if someone says poop in the chat, all 3 noob avatars respond then they walk to their own part at their position when they receive the bindable event signal
I Will have to do further tests to prove it’s true
Yes, multiple connections can be made to bindableevents
There’s also a completely lua based version which is worth checking out:
robloxapp-20231222-1916330.wmv (661.6 KB)I have some more proof I definitely used a BindableEvent. i have evidence that i did use a bindable event. check this image
A bindable event basically allows two or more scripts to communicate with one another. There’s also BindableFunctions, they basically do the same thing however they work very differently. I honestly don’t know how I can make it more simple than that.
three months but thanks for explaining.
Whoops my bad, sorry for the bump
a BindableEvent is like a RemoteEvent but it is one sided like Server-Server or Client-Client
I, Rileyg1974 know how they work. You just run :Fire() on the script then the signal is transmitted over the event, and it’s received in the listening script. You can also carry some arguments like a string. However they have one weakness from my experience, they only work on the server side
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.