How to make SurfaceGUI TextLabel.Text resize?

I have a script where a user can type what they want in a textbox and it would appear on a part. I want to know how can I resize the Text on the TextLabel if the players put more text?
More text = Smaller size
Less text = Bigger size
How would I make this possible?
Current script:

local event = game:GetService("ReplicatedStorage"):WaitForChild("text")

local function text(player, textid3)
    script.Parent.Text = textid3
end

event.OnServerEvent:Connect(text)

If you need more ask!

Perhaps TextScaled could help you here. It does what you want automatically, and you should also be able to use a UITextSizeConstraint to constrain the max size for the text if necessary.

This is the easiest way to go about this, hope it helps!

1 Like

Thanks, is it possible that I can see an example?

Check the TextScaled box in the properties window. If you want to set a minimum and maximum text size, insert a UITextSizeConstraint and adjust the values to your desire

1 Like