Add a UI constraint to enforce uniform, scaled text size between text elements

Right now, synchronizing the text size between multiple Text* instances in a GUI requires a script to do so, granted the text should be scaled based on the container size.

This feature would make it so that I can have an effect similar to TextScaled=true across many text-based elements, however, the size of the text would be uniform across all instances (effectively, whichever scaled text has the smallest text defines the maximum size for the other elements).

A script to do this is relatively complicated and less than ideal when many UI components require this. Included below is an example model that emulates my desired behavior.

MultiTextScaleTest.rbxm (5.7 KB)

What the script does is iterate through all text elements, and sets TextScaled=true. It then tracks what the height of the text is when scaled, and finds the minimum value. After this, it iterates through them again, setting TextScaled=false and setting TextSize to the minimum value.

The result is a uniform text size that respects the size of the container element. This method does not function for text that wraps, unfortunately. This could be resolved by figuring out how many lines the text takes up and rerunning the minimum scale finder again.

Having an automatic instance that provides this functionality would save a lot of work.

10 Likes