simple question, is there any way to check if the player mouse is hovering over any ui? sumthin like the gameprocessedevent in userinputservice.inputbegan
I have an idea, if you made an event every time the mouse moves, you can use
:GetGuiObjectsAtPosition, which returns a table of all gui objects at a certain position(which in this case is the mouse position). And if that table is not empty, that means you are hovering over a ui.
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() Mouse.Move:Connect(function() local MousePos = game:GetService("UserInputService"):GetMouseLocation() - game:GetService("GuiService"):GetGuiInset() local getGUI = Player:WaitForChild("PlayerGui"):GetGuiObjectsAtPosition(MousePos.X,MousePos.Y) if #getGUI ~= 0 then print("hovering over a gui!") end end)
Some links here
Demonstration of someone using the function
Issues you may incounter
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.