Frame.AbsolutePosition being inaccurate with UIListLayout

I’m trying to position my frame that appears whenever you click the button to the TextButton’s absolute position. I don’t want it to move along with the button.

However, considering that I’m using UIListLayout on the button, it seems to place the frame inaccurately. I even tried messing with the anchor points but to no avail.

This is when I put both button and the frame’s Anchor Point to {0.5, 0.5}. Keep in mind that the button is still within the UIListLayout.

And then to {0, 0}.
Frame’s Absolute Position = 409, 425
Button’s Absolute Position = 409.5, 461
image

I’ve searched through the DevForum, but it seems there is no issue that include the UIListLayout.

MenuButton:OnEvent("Activated", function(Button: GuiButton)
    local newOnClick = OnClickFrame:Clone()
    local AbsolutePosition = Button.AbsolutePosition
    local AbsoluteSize = Button.AbsoluteSize

---------------------------------------------------
-- the code that manipulates the position
    newOnClick.Parent = DebrisScreenGui
    newOnClick.Position = UDim2.new(0, AbsolutePosition.X, 0, AbsolutePosition.Y)
    newOnClick.Size = UDim2.new(0, AbsoluteSize.X, 0, AbsoluteSize.Y)
---------------------------------------------------

    Tween(newOnClick, {Size = newOnClick.Size + UDim2.new(0, 20, 0, 20); BackgroundTransparency = 1}, ButtonInfo)
    :andThen(function()
        newOnClick:Destroy()
    end)
end)

You’re probably running into issues with the gui inset. I believe in the screen gui you can turn that off (ScreenGui | Documentation - Roblox Creator Hub) or you could account for it using GuiService | Documentation - Roblox Creator Hub

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