How to make frames sink textbutton input?

Title speaks for itself


Notice the fade to black when switching menus. Even if the button is completely obstructed, I can still press it just fine


Here’s the same problem but simpler

I’m using MouseButton1Click, MouseEnter and MouseLeave to detect input on each button & the Active property is always enabled (both on the button and the frame)

when u click it just make the button visible = false

1 Like

I’m trying to avoid hiding the UI

maybe just disable the button then, that is have a bool attribute then change it on fade

Then whatever you wanna show on top, make sure their Z-Index is the highest.

in the first example zindex is 1-10 for the ui and 11-20 for the prompt (including its background) so there shouldnt be any issues, in the 2nd example it’s the same

Oh wait, so your problem is the button getting fired even tho it’s “invisible”, well if that’s the case, the solution should just be to set that GUI element’s Enabled to false when it’s supposed to invisible. And that would stop interactivity with it.

I’m trying to avoid setting any properties manually considering it would be very annoying to do even if the entire ui has a shared state, and I can swear this worked at some point

Or better yet, just set the UI element’s Active to false:
image

How would it be annoying? This is like the bare minimum of scripting you gotta do. There is no way around it, as long as the player can hover over the button’s region, it will interact with it, be it invisible or not. There are properties explicitely made to solve stuff like this.

Frames won’t really ever sink anything, even when “active.” It is a bit of a misnomer.

You can “disable” a button by turning its Active, AutoButtonColor, and Selectable values all to false. This will cause it not to react to any input that isn’t explicitly defined by code.

Setting Active to false will prevent any code hooked to GuiButton.Activated from firing.
Setting AutoButtonColor to false will block the default on-hover effect.
Setting Selectable to false will prevent gamepads from selecting the control.

If you need a half-measure where partially-covered buttons react when clicked on the visible portion but not the covered portion, using any type of GuiButton (instead of a Frame) in front of the button will sink input (regardless if that control itself does anything with it) without requiring you to disable the overlapped button; however, the partially-covered button will still exhibit on-hover effects if AutoButtonColor is set to true.

1 Like

Thanks for explaining their actual behavior. I’ll try to use the button hack or bite the bullet.
Edit: It doesn’t seem to block MouseEnter/MouseLeave, but stopping button input is good enough

1 Like

I have several button connections that are single line statements.


having to check for .enabled would mean i’d have to dirty up every single event connection I am making eg. shove another if statement inside of it. I was assuming there is an actual implementation that stops you from pressing buttons behind FULLY opaque frames.

It really isn’t something hard to implement, just redo your stuff and you should be fine. And if buttons stopped being interactive behind fully opaque frames, that would cause some limitations, because they already gave you the option to disable the interactivity to begin with.

If you need help redoing it, you can ask for help again if you are stuck.

You missed the point of my reply. I’m not going further with this.

I didn’t miss anything, all I am saying is that the issue you are having has a solution.