Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I scale a TextLabel based on the amount of Text inside?

Asked by 4 years ago
Edited 4 years ago

I want to make a TextLabel's Size increase with how much text is inside, TextWrapping and having the Label increase in size.

(Not a request, but a question you may help me with, even answer if you want)

3 answers

Log in to vote
0
Answered by
St_vnC 330 Moderation Voter
4 years ago

You could know how many characters are in the text by doing

local Characters = #”Hello World”

Then you can scale it based on the amount of characters

local Size = UDim2.new(0,Characters*10,0,Characters*10)

It’s basically Characters multiplied by the amount of pixels

Ad
Log in to vote
0
Answered by
NSMascot 113
4 years ago

add a 'UITextSizeConstraint' to the textlabel/textbutton

Log in to vote
-1
Answered by
H34E7R 19
4 years ago
Edited 4 years ago

I believe ROBLOX already has a TextScaled implemented within their Gui systems to help with this.

0
Yeah and it sucks. It gives horrible results with large numbers and with small values literally consuming the entire gui Gojinhan 353 — 4y

Answer this question