How to get gui position

I want to position a frame to a position but my calculation doesn’t seem to be right.

local x = otherFrame.AbsolutePosition.X + frame.AbsoluteSize.X / 2
local y = otherFrame.AbsolutePosition.Y + frame.AbsoluteSize.Y / 2
frame.Position = UDim2.fromOffset(x, y)