I’m making a custom hovering system with my mouse for performance optimization, and it seems that the AbsolutePosition doesn’t actually represent its exact position on the screen, specifically in the Y. To demonstrate, I set up a quick script.
while task.wait() do
local frame = script.Parent.Frame
local mouse = game.UserInputService:GetMouseLocation()
frame.Position = UDim2.new(0, mouse.X, 0, mouse.Y)
frame.AbsPosition.Text = "AbsPosition: "… tostring(frame.AbsolutePosition)
frame.Pos.Text = "Position: "… tostring(frame.Position)
frame.MousePosition.Text = "Mouse: "… tostring(mouse)
end
This doesn’t seem to work in my actual experience, I’m not sure why, but it could be the ancestry of the UI, which involves many different frames as well as layouts and aspectRatioConstraints.
Individual elements are added during runtime, but the mismatch still occurs when measuring the absolutePosition and the mouse position.