Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to get the position of a GUI object that has UIListLayout?

Asked by 4 years ago
Edited 4 years ago

I have a simple example of a GUI, the layout is as follows:

- ScreenGui
    - Frame
        - UIListLayout
        - SubFrame1
        - SubFrame2
        - SubFrame3

The position of each SubFrame is locked by the UIListLayout, so the .Position property will always be a Vector3 of (0, 0, 0, 0).

I want to create a new frame based on the relative position of the SubFrame (inserting children into the SubFrame is not an option).

Is there a way of getting the position of say, SubFrame3?

1 answer

Log in to vote
1
Answered by
megukoo 877 Moderation Voter
4 years ago

You could retrieve this by doing SubFrame3.AbsolutePosition. Remember that this will give you a Vector2 with X, Y values in screen offset.

You could convert this to scale measurements (based on the parent frame size) by doing SubFrame3.AbsolutePosition.X/Frame.AbsoluteSize.X.

Ad

Answer this question