GetGuiObjectsAtPosition doesn't ignore disabled GUI

Reproduction Steps

Expected Behavior

I expect GetGuiObjectsAtPosition to only return GuiObjects that are Visible and under a GUI that is enabled

Actual Behavior

GetGuiObjectsAtPosition returns GuiObjects that are Visible and under a GUI that is disabled

image

Code
local Players = game:GetService("Players")
local localPlayer: Player = Players.LocalPlayer
local playerGui: PlayerGui = localPlayer and localPlayer.PlayerGui
local mouse: PlayerMouse = localPlayer and localPlayer:GetMouse()

local GUI = script.Parent

local Frame = GUI.Frame

mouse.Button1Down:Connect(function()
	print(playerGui:GetGuiObjectsAtPosition(mouse.X, mouse.Y))
	print("Frame.Visible", Frame.Visible)
	print("GUI.Enabled", GUI.Enabled)
end)

GetGuiObjectsAtPosition doesn’t ignore disabled GUI.rbxl (39.5 KB)

Issue Area: Engine
Issue Type: Other
Impact: High
Frequency: Constantly
Date First Experienced: 2022-01-01 00:01:00 (+07:00)
Date Last Experienced: 2022-09-20 00:09:00 (+07:00)

1 Like

Hey!

I tested your place but it seems to be working as expected.

11:40:31.679  {}  -  Client - LocalScript:11
11:40:31.679  Frame.Visible true  -  Client - LocalScript:12
11:40:31.680  GUI.Enabled false  -  Client - LocalScript:13

Can you list your repro steps please? A video of the issue would be helpful too.

Thanks!

Hey, not the OP but I was able to reproduce this.

  1. Start play test session
  2. Click to verify Visible and Enabled are true, and the table contains the frame
  3. Run game.Players.LocalPlayer.PlayerGui.Enabled.Enabled = false
  4. Click again
  5. Results should show a table containing the frame, and Enabled false

From messing around a bit, it seems that it will update if the ScreenGui was previously disabled, but won’t update if it was previously enabled.

Hey!

I’m able to reproduce the results you’re seeing. However, changing the API isn’t an option right now. My suggestion would be to check the parent of the current object recursively until you get the GUI it’s under and check if it’s Enabled.

Thank you!

Closing out as not a bug as per post above. Please file this issue as a feature request if you need this functionality!