I have a Frame and inside it is a TextButton:
I need BasePlayerGui:GetGuiObjectsAtPosition to show all objects inside the frame.
So I have this in a LocalScrip
:
local ContextActionService = game:GetService("ContextActionService")
local UserInputService = game:GetService("UserInputService")
local Players = game.Players
local Player = Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local GuiService = game:GetService("GuiService")
local function MoveMouse(ActionName, InputState, InputObject)
local Pos = UserInputService:GetMouseLocation() - GuiService:GetGuiInset()
local GuisAtPosition2 = PlayerGui:GetGuiObjectsAtPosition(Pos.X, Pos.Y)
print("GuisAtPosition2: ", GuisAtPosition2)
end
ContextActionService:BindAction("MoveMouse", MoveMouse, false, Enum.UserInputType.MouseMovement, Enum.UserInputType.Touch)
But it’s detecting only the Parent frame and not finding the inner element TextButton
:
What’s wrong?