How to refresh TextScaled

When the Text Property is changed on a TextLabel Object and TextScaled is on, the font size is not recalculated and can result in short text becoming small if the previous one was longer, and I want to refresh the property. I’ve tried this:

function refreshTextScaled(textObject)
	if textObject and textObject:IsA("TextLabel") and textObject.TextScaled == true then
		textObject.TextScaled = false
		task.wait()
		textObject.TextScaled = true
	end
end

which was made by AI and slightly edited by me. However, the function seems to simply not run on the live client, as there aren’t errors on the output. :frowning:


If this is quite hard to make, I can always make the TextLabel bigger horizontally. Tell me if this is the best option.

You can use UITextSizeConstraint. There you can set min and max values of text size, scaled by TextScaled. If you meant something else you can also try RichText property of text. It can add another row to text if it is too long.

I don’t want to use the same Text Size, and that’s the issue. I guess I’ll just stretch the TextLabel horizontally…

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.