GUI offset influenced by parent

Howdy! Sorry if there’s already a post on this but I can’t find exactly what I’m looking for.

My goal is to set the green square AbsolutePosition to the purple AbsolutePosition. I can’t just copy the purple offset to green because the green square is a child of orange and relative to that position. Also, I’m not interested with “Scale”. I just need to replicate the Offset.

Screen Shot 2022-12-26 at 9.02.13 AM

My goal “green overlapping purple with same offset”
image

Is this what is recommended? It appears to work!

local gui = game.StarterGui.ScreenGui
local orange = gui.Orange
local green = orange.Green
local purple = gui.Purple

local relativePos = orange.AbsolutePosition - purple.AbsolutePosition
local relativeUDim = UDim2.fromOffset(-relativePos.X,-relativePos.Y)

green.Position = relativeUDim