So as a UI Designer I am trying to figure out how to create this effect where a popup follows the user’s cursor:
I mainly don’t understand how to find the player’s cursor position and rapidly update it, I know how to make the popup appear on hover, just not how the position is found. Sorry if confusing.
Just make a tooltip element which is always at the mouse pos. Then, set it’s text to whatever the player hovers over. Only make it visible when hovering over something.
To keep it locked to the mouse, just connect a function to UserInputService.InputChanged. Check if the input object is Enum.UserInputType,MouseMovement, and if it is you just move the tooltip to input.Position.X,input.Position.Y+GUI_inset.Y
Update the position of an element to the mouse location.
local tooltipLabel = script.Parent.TooltipLabel
local tooltipHeight = tooltipLabel.Size.Y.Offset
local horizontalOffset = 10
local verticalOffset = -tooltipHeight / 2
local userInputService = game:GetService(“UserInputService”)
local mousePos = userInputService:GetMouseLocation()
local adjustedPos = UDim2.new(0, mousePos.X + horizontalOffset, 0, mousePos.Y + verticalOffset)
tooltipLabel.Position = adjustedPos