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

How can I correctly size a text label?

Asked by 3 years ago

I tried to make a text label the exact right size (using code) to fit the text perfectly, but it didn't work :(

Heres what I tired to use but I couldn't understand it so I made my own not working one Not a IP logger

Here are some of the text settings: Font Size - 18 Font - GothamBold X Snapping - left

Useful info, it needs to return a Udim2 if offset form NOT SCALE!!!!!

0
If you want the text to fit you just can enable TextScaled property yuni_Boy1234 320 — 3y

2 answers

Log in to vote
0
Answered by 3 years ago

If you really don't want to use Scale, then you can do some brain breaking math to center it regardless of resolution. You need to take advantage of the AnchorPoint property. Normally setting AnchorPoint to (0.5,0.5) and Position to (0.5,0.5) would do it, but depending on what you are trying to do you have to try with different values.

0
I am trying to scale the box to fit the text perfectly deadwalker601 110 — 3y
0
I explained exactly what to do in my answer User#32819 0 — 3y
0
You are positioning it to the center of the screen deadwalker601 110 — 3y
0
Yeah, but it was just an example bruh User#32819 0 — 3y
View all comments (2 more)
0
Im trying to SCALE to the correct size to perfectly fit the text deadwalker601 110 — 3y
0
Exactly, I gave you an example so you can adjust it for your need User#32819 0 — 3y
Ad
Log in to vote
0
Answered by
Sulu710 142
3 years ago
Edited 3 years ago

All you have to do is shrink the text box until the TextFits property is false, then set it to one increment larger so it's as small as it can be with the text still fitting in the text box.

0
How do I do that via script? deadwalker601 110 — 3y

Answer this question