Is it possible?
Well that’s pretty straight-foward. BindableEvents / Functions can work between LocalScripts as well as ServerScripts, both LocalScripts will just need a reference to the same BindableEvent. I would insert it into ReplicatedStorage, so that LocalScripts can access it easily.
Here is an example where one LocalScript gives another LocalScript a message to print out:
-- LocalScript 1
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local bindableEvent = ReplicatedStorage:WaitForChild("BindableEvent")
bindableEvent:Fire("Hello, world!")
-- LocalScript 2
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local bindableEvent = ReplicatedStorage:WaitForChild("BindableEvent")
local function OnEvent(message)
print(message) --> Hello, world!
end
bindableEvent.Event:Connect(OnEvent)
i placed two local scripts in starterpack and a bindable event and when i went to test it printed nothing
Where did you put the BindableEvent
?
replicated storage
Did you name it “BindableEvent” or just “Event”?
BindableEvent
if it was named Event it woudlve just say InfiniteYield
Works fine for me. You probably did something incorrect.
i forgot the task.wait xd
I believe it is partly my fault since I didn’t specify the event won’t connect instantly. If you are not firing it immediately then you can leave out the task.wait()
.