I want to know how I would get the child’s absolution position inside a scrolling frame including factors like AutomaticCanvasSize and also UI Modifier Instances.
Right now if I just get the absolute position of a child in a y axis scrolling frame, the x position would be correct but the y position would be wrong.
You need to add the ScrollingFrame’s current scroll offset to the child’s AbsolutePosition. AbsolutePosition alone ignores both CanvasPosition and UI modifiers.
A correct Y value looks like this:
local absPos = child.AbsolutePosition
local realY = absPos.Y + scrollingFrame.CanvasPosition.Y
If you use UIListLayout/UIGridLayout with AutomaticCanvasSize, this still works because the layout only affects the canvas size, not the offset.
I’ve modified your code a little bit and there’s still a little offset from the actual position
local scroll = script.Parent.ScrollingFrame
local child = scroll.Frame2
local y = child.AbsolutePosition.Y + scroll.CanvasPosition.Y + child.AbsoluteSize.Y
print(child.AbsolutePosition.X, y)
The issue is that you are adding child.AbsoluteSize.Y to your calculation, which pushes the position to the bottom of the orange frame instead of the top.
Additionally, in Roblox, AbsolutePosition already accounts for the CanvasPosition in real-time. If you add it manually, you are doubling the offset.
local scroll = script.Parent.ScrollingFrame
local child = scroll.Frame2
-- This is the exact screen position
local x = child.AbsolutePosition.X
local y = child.AbsolutePosition.Y
print(x, y)
Remove + child.AbsoluteSize.Y: This was causing the vertical gap seen in your screenshot.
Don’t add CanvasPosition: AbsolutePosition is a screen-space property. As you scroll, the AbsolutePosition of the child updates automatically to reflect where it is on the screen.