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

Is there a way to get the amount of characters in a textbox?

i'm trying to create a GUI and i need to get the number of characters in the text Box like do i do TextBox.Length or something?? please help thank you

2 comments

0

please help

0

This Isn't a request site

1 answer

✓ Accepted answer

Yes! You can use a string function on the Text property of the TextBox to get the length of the current text.

Here is some sample code (assuming the LocalScript is inside of the TextBox

print(string.len(script.Parent.Text)) -- prints the length of the TextBox text when the script is ran

Learn more about the methods I used here: https://developer.roblox.com/api-reference/class/TextBox https://developer.roblox.com/articles/Lua-Libraries/string

(Did this answer help? Mark it as the correct answer/upvote it to help me out!)

3 comments

0

No. Don't use string.len. Use the length operator #

0

Why not use string.len? You could use #, but I prefer using string.len. They both give the same result, anyways.

0

The reason to not use string.len is because we have the length operator. There is absolutely no reason to use len anymore

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