I have this info that appears hwen you click on a button. The Backpack has a UIScale in it.
function BackpackUIController:SetInfoPosition()
task.wait() -- Wait a split second in case of touch
local MouseLocation = UserInputService:GetMouseLocation()
local Offset = HUD.Backpack.Info.Triangle.AbsoluteSize.X / 2
HUD.Backpack.Info.Position = UDim2.fromOffset(
(MouseLocation.X + Offset) - HUD.Backpack.AbsolutePosition.X,
(MouseLocation.Y + Offset - Constants.TOP_BAR_OFFSET) - HUD.Backpack.AbsolutePosition.Y
)
print("Mouse", MouseLocation, "Info", HUD.Backpack.Info.Position)
end
When the scale is set to 1, the info appears in the correct spot, basically my mouse being the corner of the info frame.
However, if I set the UIScale to 1.4, and click on the frame, it not sets the info frame way off to the side.
I am unsure why this is happening. I am using AbsoluteSize/Position of the frame to get positions correctly, but it’s always skewed. If I increase the scale, it just gets further and further away from the mouse.
For anyone asking, the UIScale for all my frames gets changed to 1.4 if the player is a smaller device (mobile) that way all the frames are upscaled without needing to do crazy work to scale each frame specifically.
Idk if I need to times the position by the scale or something.