GetTextSize/TextBounds giving inaccurate values, thus causing AutomaticSize to be off

I am trying to use GetTextSize (or TextBounds property) to get the size of a TextLabel, because if I just do AutomaticSize, it’s making the label a lot bigger than it really should be.

But even with GetTextSize, it’s giving 221, which is the same size AutomaticSize is setting it to

Expected behavior

Based on this, the CORRECT x value should be ~89

Are you sure it’s not because your UIScale is interfering with the measurements? I use AutomaticSize extensively in my projects, and they don’t have many problems, provided you don’t use scale on the sizing axis.

1 Like

image
All UIScales are set to 1 atm

Are you able to send the model so I can test it out?

Set the X axis to 0. When you use AutomaticSize, it’ll only interfere if the size must be bigger than what you inputed in the size property.

1 Like


X is 0

Billboard.rbxm (13.7 KB)

I do not encounter the issue in my side:
Screenshot 2025-02-27 194012

EDIT: I tried setting back AutomaticSize to None and then to X and experience, however disabling scaled text fixed the issue.

EDIT 2: I managed to get an equivalent result by setting the size to 38.

Here are some problems:

  • You forgot to toggle the automatic size for your “Coins” text label
  • Don’t use 0.5, 0.5 anchor points on items with automatic size; you should not be setting anchor point to 0.5, 0.5 when the position is being overridden by a list layout anyway. 0.5, 0.5 should only be used if you’re trying to position something relative to the center of its container.
  • You’re using scale on the x-axis in the “Divider” instances in combination with automatic size on the x-axis
  • You’re using scale on the x-axis in the “Icon” instances in combination with automatic size on the x-axis
  • You’re using text scaled on text objects with automatic sizing

There are things you shouldn’t be doing when using automatic size because they cause undefined behaviour. This isn’t a bug.