Is there a way to; size a text-label based on screen resolution?

Hi! I’m trying to achieve sizing a Text Label based on the screen resolution.

I’ve tried a few things, nothing worked.

Please help if you can! :slight_smile:

3 Likes

You can use UDim2.fromScale(x, y) to scale the textlabel relative to the screen dimensions and then set the TextScaled property of the textlabel to true so the text gets automatically resized to fit the textlabel’s size

What @hell_ish said, but you can just set the scale in the properties tab as well. Size and Position properties for GUIs are like this {ScaleX, OffsetX, ScaleY, OffsetY}. So just change both scale numbers - they work like percentages. 0.5 is 50% of the width/height.

Udim2 already lets you do that - it’s a data type that lets you set gui size based on screen size and/or pixels. Like AvionicScript said, it’s {ScaleX, OffsetX, ScaleY, OffsetY}. ScaleX and ScaleY specify what part of the screen’s size the gui will take. For example setting ScaleX and ScaleY to 1 will make the gui exactly same size as the screen.

I don’t know how to use these, help/example?

I’m trying to use this with 2 text labels, and a UILISTLAYOUT.

I use a plugin that can fir every UI element regardless of the resolution of the device.

you can also use a UIRatioConstraint

As far as I know, UIListLayout doesn’t affect size, only position. Also, I forgot to mention that Scale is based on screen size only if it’s parented directly to the GUI, otherwise it’s based on parent’s size. If you want to scale a gui object which is in another gui object based on screen size, you’ll need some math.

Didn’t work for me, screwed up the top, and everything.

1 Like

If you are not able to fo it yourself use a plugin

That plugin is off-sale. Why did you post it?

ah i didnt see i had the plugin installed! there are other alternatives

1 Like