BindableEvent not firing, for some bizarre reason

I have used BindableEvents a million times, but I have no idea why this isn’t firing. I feel like it’s a really simple, dumb mistake, but I cannot for the life of me spot it.

ScriptA:

RoleplayButton.MouseButton1Click:Connect(function()
	print("Client Fired")
	Player.PlayerGui.RoleplayMenu.Events.HandlerBindable:Fire("Initialize")
end)

ScriptB:

Events.HandlerBindable.Event:Connect(function(func)
	
	print("Fired Server")

	if not func then return end
	
	if func == "Initialize" then
		script.Parent.Enabled = true
		tweenOut:Pause()
		tweenIn:Play()
	end
end)

Proof that the event is in the correct place:
image
Events is defined as script.Parent.Events

5 Likes

Hi Ray,

I just want to clarify something; are you attempting to transfer data between a client and the server? If so, you might want to try using a RemoteEvent in this case.

Hope this helps!

1 Like

No, this is communication from the client to the client.

Essentially, I have a “main menu” UI sortof deal. Pressing a button on that should open up a second menu, i.e. the RoleplayMenu.

I have three other menus that work just fine using practically the same code, it’s just that for some reason this specific instance isn’t working.

1 Like

I can’t seem to find anything wrong with the code provided. Did you want to provide a similar snippet of code for another menu that works? I also take it that it prints “Client Fired” but nothing from the other script?

1 Like

Another code snippet (it’s quite literally the same, just with a couple variables switched):

BuildingButton.MouseButton1Click:Connect(function()
	Player.PlayerGui.BuildingMenu.Events.HandlerBindable:Fire("Initialize")
end)
Events.HandlerBindable.Event:Connect(function(func)
	if not func then return end
	
	if func == "Initialize" then
---etc, this is a longer function but same setup.

And correct in regards to the print functions. I get “Client Fired” but not the other part.

1 Like

What type are the scripts? You might be firing or receiving it from the RoleplayMenuServer script, which will only do so server-sided.
Also why would you put a server script inside PlayerGui (just wondering)

1 Like

Have you tried making another script on the receiving end to see if it gets fired?

As people have mentioned above, the Script receiving the signal is a server script. Bindable Events require client to client communication, and you have a Client to server communication. If you wish to change this Use a remote event. If you want a client to client connection, change the script that is getting the signal into a local script.

Your RoleplayMenuServer script needs to be a Local Script.

Or, you need to use a RemoteEvent since you are sending info between a Server Script and a Local Script.

Both are local scripts.

I have a server script in the UI mainly just to handle server-sided requests that I cannot handle in client scripts, or changing various variables (such as, in this case, a GUI above the player’s head).

I know there are other ways to do this. I prefer keeping things orderly and grouped up like this.

Yes, and the same issue persists. I do not know why that event will not fire.

No it isn’t. It is on a local script.

I am very aware of the restrictions between BindableEvents and RemoteEvents.

Except it doesn’t, because that is not what it is designed for, and it is not where the function I have mentioned above is located. As I have already specified in an earlier reply, i am sending from one script on the client, to another script on the client.

Your picture is confusing to me.

image

“RoleplayerMenuServer” is a server script. Where is the 2 scripts your calling and recieving the signal from if there is only one valid local script in the picture in the orginal post? Thats just where I am confused

Oh, I see the confusion then.

As I explained in an earlier post, I have a main menu that opens other menus. These are two different UIs I am referring to here.

Script A is in a client script that is not pictured in that screenshot. The function in Script B is from RoleplayMenuClient.

Purpose of the screenshot was merely to show the directory of the HandlerBindable event.

Where is script A (one not pictured) located in (it’s parent)? And while I’m asking these questions, What has it printed so far as your scripts do have prints?

I’m guessing Player.PlayerGui.RoleplayMenu.Events isn’t referencing the right thing. Could you show where ScriptA is?

Is there any code in either of the scripts above where you’re connecting functions to the events that yields forever, like while loops? If so, you can use task.spawn() to run them without yielding the rest of your code.

If you’re having trouble finding where it could be yielding, you can set a a break point at the top of your script, and use the debugger to go line by line until you find the issue.

To create a break point, click to the right of the line number:
image