I’m wondering why you need do convert absolute position to relative position, maybe a custom cursor? Anyways, here’s how I would do it:
I will explain it using two frames.
The given absolute position: 500, 500
The absolute position of the parent frame: 300, 300
We have to subtract the parent frame’s absolute position from the child frame’s absolute position, giving you a relative position of 200, 200. (so (0, 200, 0, 200).
You also have to account for any offsets, ie if the anchorpoint of the parent frame is 0.5, 0.5, then you have to add half the size to the x and y.
For instance, the parent frame’s size is 400, 400, and the anchorpoint is 0.5, 0.5, meaning you have to add 200 to x & y.
This gives us a final relative position of (0, 400, 0, 400)
Shown in red is the starting absolute position 500, 500, black is the child frame at 400, 400 with an absolute position of 500,500


function AbsToUDim2Pos(ParentPos:UDim2, ParentSize:UDim2, ParentAnchorPoint:Vector2, AbsolutePos:UDim2)
local child_x = AbsolutePos.X.Offset - ParentPos.X.Offset
local child_y = AbsolutePos.Y.Offset - ParentPos.Y.Offset
child_x += ParentSize.X.Offset * ParentAnchorPoint.X
child_y += ParentSize.Y.Offset * ParentAnchorPoint.Y
return UDim2.fromOffset(child_x, child_y)
end
local ParentPos = UDim2.fromOffset(300,300)
local ParentSize = UDim2.fromOffset(400, 400)
local ParentAnchorPoint = Vector2.new(0.5, 0.5)
local AbsolutePos = UDim2.fromOffset(500, 500)
print(AbsToUDim2Pos(ParentPos, ParentSize, ParentAnchorPoint, AbsolutePos))
-- LIVE DEMO:
-- move the frame "target absolute position 500, 500"
-- and the child frame will move to the same position.
-- (((Apologies for the horrible frame names.)))
while task.wait() do
local ParentPos = script.Parent["Parent Frame"].Position
local ParentSize = script.Parent["Parent Frame"].Size
local ParentAnchorPoint = script.Parent["Parent Frame"].AnchorPoint
local AbsolutePos = script.Parent["Target absolute position: 500,500"].Position
script.Parent["Parent Frame"]["Child frame"].Position = AbsToUDim2Pos(ParentPos, ParentSize, ParentAnchorPoint, AbsolutePos)
end
Feel free to modify the snippet to suit your needs.
If you would tell me why you need to convert absolute positions to relative positions, I could help you come up with a more robust solution.