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

How do I check the last character of a string before it doesn't fit a label anymore?

Asked by 6 years ago
Edited 6 years ago

Say a TextLabel is a size of 400 by 18 pixels, how would I get the position of the last character of a long string before the next character isn't visible anymore?

For example

A string in a TextLabel is 18926826898462910385 (next characters not visible). How do I get the position of that "5" at the end which is the last visible character and is the 20th character in the string?

I'm talking about string position like string.sub(TEXT, 1, 12 < That)

0
like that? string.sub(t,1,string.len(t)) User#20388 0 — 6y
0
roblox has made its own ready only proite called TextFits ima use textfits to help you Benjamin_pro1000 3 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

make it TextScaled by clicking on the object then go to properties

Or u can do this to check if it fits and change text size by doing

if object.TextFits == false then
object.TextScaled = true
else
object.TextScaled = false
end

object is the textlabel,textbox or textbutton

Ad

Answer this question