I am trying to create a gui that someone can enter text into, but I want tho limit the amount of letters they can enter. Is there a way to do this?
✓ ANSWER ACCEPTED
Is there a way to limit the amount of text someone enters?
1 answer
✓ Accepted answer
Cap it
Every time the text changes, just make sure that the text is within a certain length. This can be done withstring.sub
TextBox.Changed:connect(function()
TextBox.Text = TextBox.Text:sub(1,50);
end);
That would restrain the text length to 50 characters, by making sure that every time anything changes in the TextBox the string has anything past the 50th character cut off. Make sure that you define TextBox.
1 comment
1
Thanks so much! I usually know there is an answer for what I am asking, I'm just too lazy to search the wiki e.e
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
There is, yes.
http://wiki.roblox.com/index.php?title=Conditional_statement#If
http://wiki.roblox.com/index.php?title=Function_dump/String_manipulation&redirect=no#string.len
http://wiki.roblox.com/index.php?title=API:Class/Instance/Changed