BindableEvent not recieved by listener on client

Hi there!

I’ve got a folder of 4 bindable events with unique names inside of StarterGui.

I’ve been trying to listen to these events on the client using the following process (with some code excluded)

for _, signal in pairs(Signals:GetChildren()) do
	
	table.insert(LoadEvents, signal.Name)
	
	print('a')
	
	signal.Event:connect(function(fired)
		
		print(fired)
		
	end)
	
end

From another local script on the client, I am manually firing one of the bindable events (using :Fire()). I have a print after the event is fired from this script, which succeeds in printing every time with no error.

However, although I am 100% positive my loop iterates over each event (as the table.insert & first print do indeed work), the listener never receives the event.

I’ve restarted studio, tested in-game, all to no avail. The listener never receives the event.

I’ve done some digging and it is not related to the for loop. Manually coding a listener attached to one of the events does not connect either (even though I am positive the script is functioning)

Any advice appreciated! Thanks in advance

Could you try this:

local othersignal = nil

for _, signal in pairs(Signals:GetChildren()) do
	
	table.insert(LoadEvents, signal.Name)
	
	print('a')   
         othersignal = signal
		
	
	
end
	
	othersignal.Event:connect(function(fired)
		
		print(fired)
end)

This would not work. There is no need for the added end or reassigning the index of signal… It is not related to the for loop, I manually added a hard listener to a single one of the events outside of the loop and it still never receives the event.

Edit: Disregard the bit about the added end. I see what it was intended for now. However, I’ve already tested a similar method (the one I noted with a hard connection) and it did not work either.

Correction: I’ve seen the bindable event function but where in your code does it fire to the event?

image
1 fires event “Weapons”

1:

script.Parent.LoadedSignals.Weapons:Fire(true)
print('L')

2:

for _, signal in pairs(Signals:GetChildren()) do
	
	table.insert(LoadEvents, signal.Name)
	
	print('a')
	
	signal.Event:connect(function(fired)
		
		print(fired)
		
		table.remove(LoadEvents, table.find(LoadEvents, signal.Name))
		
		ProgressBar(#LoadEvents/Count)
		UpdateStatus()
		
	end)
	
end

The “L” after the event is fired in script 1 always prints. Neither of the listeners print, however, some prints I have later on in the code (as well as functionality) work fine, and the script doesn’t error, so the listeners should definitely exist. I do have a wait in script 1 that forces the event to fire after the listeners should be listening.

Edit: The added hard-code attempt I mentioned was this:

Signals.Weapons.Event:connect(function(thebool)
	print('hi')
end)

but this also does not work.

I think I see the problem here, you’re using a bindable event in a local script in startergui.

1 Like

I haven’t been able to find any documentation that says it is not possible, and I’ve found previous devforum posts that have had issues with getting them to work, but they work after studio is restarted.

Is it intended to not work or should I send this to bug reports?

Edit let me try creating the events themselves outside of the client and see if that fixes anything

The bindable events needed to exist outside of the client. I placed them in ReplicatedStorage (and changed my code accordingly) and it is now functional.

Ah Glad to hear, so I was right in a sense, well then good to know your issue is resolved.

1 Like