Absolute position

If i type print(textbutton.AbsolutePosition) then
it returns the position in pixels, where is the location of pixels?

image

It prints 500,128 pixels

What is this location? like is this absolute position the center position of frame in pixels? or any corner of the frame in pixels

it returns the the ui’s anchorpoint pixel position, can be the center, unless you changed the anchorpoint

What is anchor point?

characters

Do you mean like this?

it’s what you consider the starting point of the ui, roblox shows you a visualization of this:

explanation from the api reference

AbsolutePosition is a read-only property that provides the screen position of a UI element in pixels. This represents the actual pixel position at which an element renders as a result of its ancestors’ sizes and positions. The GuiObject.AnchorPoint also influences the AbsolutePosition. This property, GuiBase2d.AbsoluteSize and GuiBase2d.AbsoluteRotation are a group of properties that all describe the final rendered orientation of a UI element.

For example, on a 1920 by 1080 screen, a Frame with position {0.5, 0}, {0.5, 0} would have an AbsolutePosition of (960, 540). If you were to place another Frame with position {0, 50}, {0, 50} inside that one, its AbsolutePosition would be (1010, 590). This example assumes each Frame has the defualt GuiObject.AnchorPoint of (0, 0), the top left corner.

3 Likes

This represents the actual pixel position at which an element renders as a result of its ancestors’ sizes and positions.
GuiBase2d.AbsolutePosition (roblox.com)

If you have a frame and add another frame as the child , that child’s position and size will be relative to the parent frame’s position and rotation.
You can take the top left corner of the parent frame as the origin(0,0) for the child frame.

1 Like

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