AbsolutePosition offset?

I’m working on a popup that shows whenever you hover over certain UI elements. The only issue is it seems to be quite offset from where one might think it should be. The AnchorPoint of the hover popup is 0, 1 so that the bottom left corner should be right at where the absolute position would be.

Here’s the code I’m using to position the popup…

hoverMenu.Position = UDim2.new(0, element.AbsolutePosition.X, 0, element.AbsolutePosition.Y)

…and here’s what it looks like:

image

Unless there’s something weird about AbsolutePosition that I don’t know, then I’m not sure what’s going on. Things to note: The UI element where the absolute position is being sourced is from a child of a ScrollingFrame, with a UIGridLayout and a UIAspectRatioConstraint applied to every item. The hover popup is just parented to the a ScreenGui. Possibly this is offsetting the AbsolutePosition?

Don’t use any AnchorPoint, just go with raw AbsolutePosition Data, remove AbsoluteSize.Y of the sand thing to get the correct position, also make sure the hoverMenu isn’t parented to anything away from 0, 0. Also afaik AbsolutePosition is top left, not bottom left.

I’m aware that AbsolutePosition starts at the top left, the purpose of the AnchorPoint was to have the hover popup display above the given element.

Even without AnchorPoint, it’s still offset:

image

Also, I’m not too sure what you mean by this.

Would it work for any other instances? It could possibly be the AspectRatioConstraint. GridLayouts, ScrollingFrames and most other UI modifiers haven’t ever produced such mistakes for me before.

I was thinking this could be the issue too, but apparently not:

image

This is parented to a ScreenGui and is still offset from where you’d expect it to be. Not sure what could be causing this issue.

try to subtract the absolute position x and y of the parent of the element

hoverMenu.Position = UDim2.new(0, element.AbsolutePosition.X - element.Parent.AbsolutePosition.X, 0, element.AbsolutePosition.Y - element.Parent.AbsolutePosition.Y)

The hover popup didn’t show up on screen. It has to be an issue with the code, unless it’s a bug.

Hey, sorry for the bump but did you find any solutions? I’m having the same problem right now: when I look up the property in-game it’s different to when I print it through script
image

image

2 Likes