Get gui object position relative to screen

function getPosition(parent: GuiBase2d, pos: Vector2)
	if parent:IsA("GuiBase2d") == false or parent:IsA("ScreenGui") == true then
		return pos
	end
	
	pos = pos - parent.AbsolutePosition
	return getPosition(parent.Parent, pos)
end

help w my code please :pray: how do i get the absolute position of a nested element relative to the screen? object.AbsolutePosition returns a position relative to it’s parent

1 Like

object.AbsolutePosition returns a position relative to it’s parent

Are you sure it does? I thought it was absolute relative to the screen.
Otherwise, you just need to keep adding the AbsolutePosition of the element and its parent and its parent until you reach a ScreenGui object.

1 Like

turns out it only does this for scrolling frames!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.