Hey there, so i have a bindable event in a local script inside of a GUI, when active it is supposed to connect to another bindable event that gets generated which will be connected to another players GUI, basically a way to connect 2 player’s GUIs, however for some reason the BE only works for the script its in, when i fire the event from one script it can only be detected in said script, the other one doesn’t even get a event, anyone have any idea why this is happening? they are the same local script in player GUI so each player has their own copy, and both player’s scripts have different values assigned when the generation happens so it isn’t both of them firing at once or something like that
anyone got any idea where im going wrong? thanks in advance.
You need to fire the other client using a remote event. If Player 1 fired the bindable event, Player 2 won’t receive a signal and only Player 1 will. Also, you are not using the BindableEvent correctly on client. You need to initiate it first before firing.
Example 1:
game.ReplicatedStorage.BindableEvent.Event:Connect(function()
print("Test") --This will print because I initiated the event
end)
game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function(bindable)
local bindable = game.ReplicatedStorage.BindableEvent
bindable:Fire() --This will fire the first line and print "Test"
end)
Example 2:
game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function(bindable)
local bindable = game.ReplicatedStorage.BindableEvent
bindable:Fire() --You will fire it but nothing will recieve this signal because we didn't connect the event yet
game.ReplicatedStorage.BindableEvent.Event:Connect(function()
print("Test")
end)
--If you put fire here it would work
end)
Keep in mind that this won’t work to connect two different clients. Use remote events. client->server-> Another client
Bindables are used for scripts which are on the same server-client boundary. (Basically means that if you have a script on server, the bindable only works on server, you can’t send info to the client. And vice versa).
thats what im trying to do but apparently bindable events arent what i thought they were, i might have to go for remote events using client > server > client
how do you use bindable events correctly then if i may ask? i thought they were used to connect 2 scripts of the same type, i.e a local script to a local script
It is correct that it is used for script firing another script (Server-side) or local script firing another local script (Client-side), but you can do it only for the same client. When a local player fires this bindable event, it is only fired for this player without including the other players. A local player can’t connect to another local player directly, it has to go from one client to the server and then to another player through remote events/functions.