Turn off click-through GUI

Right now, GUI objects underneath semi-transparent GUI objects can trigger mouse events (click, hover, etc.) How would I disable this?

1 Like

Maybe disable the buttons’ scripts?

2 Likes

Is there possibly a better solution? I don’t wanna have to disable/disconnect the scripts every time the menu is opened. At that point I’d rather just hide the sub-menu.

1 Like

As far as I’m aware theres no better solution, I would just check if that frame is visible in the buttons script and return if it is.

Would be much easier if all your buttons were handled inside a loop (e.g.)

for i,v in buttons:GetChildren() do
    if v:IsA("TextButton") or v:IsA("ImageButton") then
        v.MouseButton1Down:Connect(function()
            if statframe.Visible == true then return end

Yes, there is a hacky way to do it.

Instead of using a semi-transparent Frame for background, use a TextButton with same properties and AutoButtonColor set to false and Modal to true. This will block firing click events on buttons behind it. Not sure about MouseEnter and MouseLeave events

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.