UIScale

Show Deprecated

A UIScale object simply contains a number that is used to multiply the GuiBase2d.AbsoluteSize of the parent UI element. This number is stored in UIScale.Scale.

Code Samples

UI Scale Demo

1-- Lay out the images in a list
2Instance.new("UIListLayout", script.Parent).SortOrder = Enum.SortOrder.LayoutOrder
3
4-- Create some images of varying sizes using UIScale objects
5for size = 0.2, 1.5, 0.2 do
6 local image = Instance.new("ImageLabel")
7 image.Image = "rbxassetid://284402752" -- an image of a Lock
8 image.Parent = script.Parent
9 image.Size = UDim2.new(0, 100, 0, 100)
10 -- Scale the image by adding a UIScale with the size
11 -- Note: this is a shorthand since we don't need a reference to the UIScale
12 Instance.new("UIScale", image).Scale = size
13end

Summary

Properties

Determines the multiplier to apply to the parent UI element's size.

Events

Methods

Properties

Scale

The Scale property determines the multiplier used on the parent UI element's GuiBase2d.AbsoluteSize. When set to 0.5, an AbsoluteSize of {0, 200}, {0, 50} becomes {0, 100}, {0, 25}. Similarly, when set to 2, such an AbsoluteSize would become {0, 400}, {0, 100}.

Events

Methods