Allow to easily prevent clicks from passing through Guis

As a Roblox developer, it is currently too hard to prevent clicks from passing through Guis.
For example, if I have many buttons and I want to create a temporary frame over these buttons, these buttons are still clickable:

TextButton = game.Players.LocalPlayer.PlayerGui.ScreenGui:WaitForChild("TextButton")
TextButton.MouseButton1Click:Connect(function()
	print('click')
end)

If Roblox is able to address this issue, it would improve my development experience because this will save me from having to create additional controls on each button to detect if there are any frames on them to prevent these clicks from being accepted.

22 Likes

Did you even bother to test what you’re claiming?
Please, put here an example that works, before saying that I should mark it as a solution.

2 Likes

Not even a valid response. Don’t reply with stuff untested, and definitely incorrect.

2 Likes

Your best bet is to honestly turn visible off on any buttons that aren’t shown.

Actually the buttons should remain visible, since I am creating a semi-transparent frame over the entire screen where the message “Please wait” will appear, which will be used when there is some slow processing, such as slow access to the DataStore.
So I shouldn’t mess with the appearance of the original Gui.

@BubasGaming @Lava4Epic
I know I can make manual controls via script, but this is laborious, since I have to control each TextButton individually.
That’s why I’m opening an ENGINE FEATURE REQUEST, not a script support request.

6 Likes

I had the same issue and I put a blank text button instead of a frame and it seemed to work just fine.

1 Like

Wow, it seems to be a clever solution! I’ll test tomorrow, thanks.

1 Like

I did the test here, replacing the Frame with TextButton and it didn’t make any difference.
Could you put here an example similar to the video I posted above, working as you said?

Try the BaseAdmin “BaseGui”. It was upgraded with this functionality to prevent multiple windows from dragging at the same time. I used the Active property, but I’m sure a text button would do the same thing.
basegui.rbxm (11.3 KB)

Although your idea of changing the Frame to TextButton doesn’t work and at the same time your example has nothing to do with what I asked for, I still created a TextButton inside your example and the problem remains the same.

Do you really know how to solve this problem?

I meant try duplicating the window multiple times. You can see that you don’t drag multiple of them at the same time.

Edit: it seems I forgot to send the dependencies. I’ll send a video of what I mean here:
robloxapp-20221017-0722174.wmv (599.2 KB)

Thanks, but I think you misunderstood the statement and are insisting on sending me a solution that is not the one I asked for.
Nevermind.

If I’m understanding this post correctly:

In the click event in your button, you can add an if statement to check if the modal GUI is visible, or another property, and if it is, just don’t run the code.

For example:

TextButton = game.Players.LocalPlayer.PlayerGui.ScreenGui:WaitForChild("TextButton")
TextButton.MouseButton1Click:Connect(function()
	if ModalGui.Visible == true then
	else
		print('click')
	end
end)

Hope this helps, and correct me if I didn’t understand this post.


1 Like

You can create overlay frame by setting its Active property to true and moving it to a different ScreenGui

2 Likes

Could you show a video or submit a project that works within what you are arguing?

i might be able to upload .rbxl file here in my spare time

Also @V_ladzec from the docs:

This property determines whether a GuiObject will sink input to 3D space, such as underlying models with a ClickDetector. In other words, if the player attempts to click a ClickDetector with the mouse hovering over an Active UI element, the UI will block the input from reaching the ClickDetector.

I’ve tested for myself and this only applies to things in the 3D space (in the world). For example, it blocks camera movement.


This feature doesn’t seem to exist even in a hacky/unintended form as far as I can tell, I do think it’d be very good to have.

Read the script inside StarterGui before changing anything

OverlayFrame.rbxl (38.0 KB)