Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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)

2 comments

0

like that? string.sub(t,1,string.len(t))

0

roblox has made its own ready only proite called TextFits ima use textfits to help you

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.