We use cookies on this site to enhance your user experience



A UIAspectRatioConstraint ensures that the parent UI element (GuiObject) maintains a particular aspect ratio even if its size is set as a percentage of its parent. If an object with this constraint is also under the control of a UILayout such as UIGridLayout, then the constraint controls the objects size and overwrites any size the layout would apply.

When applied to a GuiObject, the UIAspectRatioConstraint will make sure that the objects ratio is maintained by the value defined in UIAspectRatioConstraint/AspectRatio. The UIAspectRatioConstraint/AspectType sets what determines the maximum size of the object. When set to UIAspectRatioConstraint/FitWithinMaxSize, the constraint will make the object the maximum size it can be within the /GuiObject of the element. When set to ScaleWithParentSize, the elements maximum size will be the size of the parent while still maintaining the aspect ratio. Finally, the UIAspectRatioConstraint/DominantAxis will determine which axis to use when setting the new size of the element.


Name Type Description

Determines the width-to-height ratio to be maintained by the constraint.


Determines what limits the maximum size of the UI element.


Determines the axis to use when setting the new size of the UI element.

Inherited from Instance , UIBase , UIComponent , UIConstraint

Archivable ClassName DataCost Name Parent RobloxLocked