How to make Gui Instances under another Gui Instance NOT Clickable?

Try setting the buttons in back to not be visible when the menus are open. It’s not very efficient but it should work.

It does work, but I don’t like it because

I will mention it in the OP.

You said that you set the active property, what did you set it on? The frame or the buttons? It should be set on the frame. Although, it has been awhile since I’ve used it. From the page you linked to:

1 Like

The FaceBookFrame

I read it multiple times asking myself what am I doing wrong?

You can try setting Active to true and false with the place I provided and see if it makes any differences.

I added “I Set FaceBookFrame.Active” in the OP

Right… something is wrong. I’ve tried all 4 combinations of a button and frame being active both with the frame as a child of the button, and as siblings. Here is what I used:

local sounds = {'Ouch, 'Hey', Watch it', 'Stop that'}

local s = Instance.new 'ScreenGui'

local f = Instance.new 'Frame'
f.Active = true
f.Size = UDim2.new(0, 100, 0, 100)
f.Position = UDim2.new(0, 50, 0, 50)

local b = Instance.new 'TextButton'
b.Size = UDim2.new(0, 100, 0, 100)
b.Active = false
b.MouseButton1Click:Connect(function()
    print(sounds[math.random(1, #sounds)] .. '!')
end)

b.Parent = s
f.Parent = s
s.Parent = script.Parent.Parent.PlayerGui

I’m not aware of any changes and this doesn’t seem like the behavior defined by the wiki. I do know that there have been some huge gui/input optimizations so I wouldn’t be surprised if something was removed for the sake of speed or is currently not working.

I think I recall this being broken a long time ago as well (if I was doing it correctly back then). I’m not sure if it just broke again, isn’t being supported anymore, or lacks proper documentation.

Put the popup GUI in a separate ScreenGui. IIRC, mouse events won’t trickle through, then, as long as you click on something “Active”.

Try making the buttons unresponsive when the menu frame is visible. For that, you’ll need to track of whether or not the menu is visible somewhere in your script.

I usually create an ImageButton to serve as the backing for the popup… We’re going to look into the Active property, because it sounds like it doesn’t work as intended, but we’re not sure if games are relying on its current behavior. I believe right now setting Active to true on a Frame only prevents it from passing input through to the camera controls, not preventing buttons underneath from being clicked.

9 Likes

The Active property only blocks input from 2D-world to 3D-world. You can prevent 2D-to-2D fallthrough by using a GuiButton, since they always absorb input.

Look into fixing the documentation so that it matches the behavior, because that’s been the cause of all the confusion.

2 Likes

I am pretty sure people are relying on the active behavior to block input from going through 2D objects, but since it never worked we all had to use a work around.

I’m not quite sure where you get the impression that toggling visibility isn’t efficient. If anything, if you organize your object hierarchy, it’s a better method. Any frame or tab based work I do is normally contained in switching out the visibility of frames or using a tween for a frame within a ClipDescendants frame. I haven’t opened the repro yet so maybe I misunderstand something here.

For now, as a band-aid solution, like Anaminus said, I would use a GuiButton instead of a Frame. Alternatively, you can hold the underlying buttons to a bool (recommended the tab’s visibility) and only allow them to be pressed if it is true. The bool is set to true when the tab is opened and false when closed. Your objects will still be able to be clicked but they won’t perform any kind of actions.

button.MouseButton1Click
    if frameRelatedToButton.Visible
        performActions()

By toggling the Visibility of n amount of Buttons will require work from the Script.

Where as if it does that automatically without a script it doesn’t require (as much) work.

That’s why it’s inefficient.

Anything that requires a script to do an action is work, more work is less efficient with an equal amount of Result.

So in this case the Result that I want is the Frame to block Input going through it, if it does block input then I wouldn’t have to toggle Visibility of any Buttons which is efficient.

…it’s not less efficient to toggle frame visibility over trying to have everything visible immediately. You’re simply adding a few lines of code to your work, the script doesn’t over or under work. Same process, better practice, less problems. You could avoid the entire issue of misclicking buttons.

Calling frame visibility inefficient means you’re also labelling a majority of games that use visibility over all-visible frames “inefficient”, regardless of their performance. It’s not inefficient in any way. You wouldn’t have this issue if you switched over to that.

Would you rather prefer more lines with less headaches over less lines with more headaches? There is no efficiency or performance difference, it’s the practice that’s bad (in my opinion).


EDIT: While I stand by the point I made above, I crossed it out because I checked the repro and saw what you were trying to do. In this instance, it also changes my perspective over you trying to do X thing while it’s actually you trying to to do Y thing, hence

I made a repro in about 15 seconds that fixes your problem.
Repro for RuizuKun.rbxl (18.6 KB)

I’m trying to check out the place but

https://gyazo.com/f8c1cd73bc1256fd9bdc0c43c0964111

https://gyazo.com/20c32e48d4f0751b0d3c57c069067bd3

Fantastic, opening an Offline place requires internet, BRAVO! :clap:

while Roblox is under maintenance I can’t check out the file…

Did you just added Code that makes all the buttons Visible = false?

I’m already doing that to fix the issue for now

Edited
Ohhh, you added an if statemen,t cleaver.

1 Like

using a blank image button or text button as the menu’s background frame will stop anything underneath from being clicked. don’t know if that was mentioned already, but it’s a simple workaround

Thanks but…

Yeah, it was already mentioned in the OP.

If all else fails, move the hidden content off screen after the pop-up, then back on screen before dismissing the pop-up. This should make the experience invisible to the user while preventing issues with underlying GUIs processing input.

Reviving this thread because I believe this feature still needs to be implemented. Currently the Active property on 2d-2d interactions does not do what the docs specify. Using the ImageButton hack stated above still works but is definitely not optimal.

5 Likes

I would suggest making a bug report / feature request.

1 Like

The docs don’t say anything about Active blocking click inputs in 2D, only in 3D.

3 Likes