My UI currently hovers a few pixels above the actual mouses position
CurrentHover.Position = UDim2.new(0, Mouse.X, 0, Mouse.Y)
My UI currently hovers a few pixels above the actual mouses position
CurrentHover.Position = UDim2.new(0, Mouse.X, 0, Mouse.Y)
It looks like the Y
property of the mouse takes into account the inset of the top bar. You can subtract 36 from the Y
to remove this.
game:GetService("UserInputService").InputChanged:Connect(function(input, gpe)
if gpe then return end
if input.UserInputType == Enum.UserInputType.MouseMovement then
local location = game:GetService("UserInputService"):GetMouseLocation()
script.Parent.Position = UDim2.new(0, location.X, 0, location.Y - 36)
end
end)
You could subtract the guis absolute position from the mouses position. It’s how I center my guis that have to do with my mouse mostly.
CurrentHover.Position = UDim2.new(0, Mouse.X - CurrentHover.AbsolutePosition.X, 0, Mouse.Y - CurrentHover.AbsolutePosition.Y)
Anchor Point is 0.5,0.5 if that’s of any relevance?
local function MoveHover()
if not CurrentHover then return end
print(Mouse.X, Mouse.Y)
CurrentHover.Position = UDim2.new(0, Mouse.X, 0, Mouse.Y - 36)
end
I have IgnoreGuiInset false
And without the -36 theres still a gap
Anchor it 0.5,0.5 and try and use the example I gave if you didn’t already.