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

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

Asked by 5 years ago

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

0
please help XcrossyYTBackup 14 — 5y
0
This Isn't a request site Void_Frost 571 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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!)

0
No. Don't use string.len. Use the length operator # User#24403 69 — 5y
0
Why not use string.len? You *could* use #, but I prefer using string.len. They both give the same result, anyways. joritochip 705 — 5y
0
The reason to not use string.len is because we have the length operator. There is absolutely no reason to use len anymore User#24403 69 — 5y
Ad

Answer this question