UITextSizeConstraint not having an effect on TextLabels

  1. What do you want to achieve? Keep it simple and clear!
    Create scaled text that fits for all screen resolutions, not just mine.
  2. What is the issue? Include screenshots / videos if possible!
    Text is going outside of the box I have already set scaled to my screen when using different resolutions.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve already tried using UITextSizeConstraint, though, I’m unable to figure out where to put it, I’ve already attempted to put it inside each text label to no avail.

image

I suggest making your TextLabel instances some constant proportion to the parent ImageLabel they reside within and set TextScaled to true.

For example if you have a button with the word “Potato” in it, you could do this:

local ImageLabel = -- path to ImageLabel
local TextLabel = Instance.new("TextLabel", ImageLabel)

TextLabel.AnchorPoint = Vector2.new(.5, .5) -- Situate the text in the center
TextLabel.Size = UDim2.new(.9, 0, .7, 0) -- Make it 90% of parent's width and 70% of parent's height
TextLabel.TextScaled = true -- Make the text scale to the largest font-pixel size possible within the instance's Size
TextLabel.Text = "Potato"

^ So, you can set these properties or whichever properties you want and the Text should scale on all platforms appropriately. However …

It looks like your UIAspectRatioConstraint is in the wrong place. Maybe place it under the instance you want to keep proportions instead of the ScreenGui instance.

I’ve tried using UITextSizeConstraint and I’m pretty sure it just sets an upper and lower limit font size. I avoid it typically because it’s unnecessary in most cases I’ve come across in designing UI.

2 Likes