I made this max characters local script for the textbox, but it won't work. The character counter works, but it doesn't prevent the text from exceeded 42 characters.
Here's the script:
1 | script.Parent:GetPropertyChangedSignal( "Text" ):Connect( function () |
2 | local txt = script.Parent.Text |
3 | local chars = string.len(txt) |
4 | script.Parent.Parent.MaxCharacter.Text = chars.. " / 42" --Shows the current characters of the text. |
5 |
6 | if chars < 42 then |
7 | txt = txt:sub( 1 , 42 ) |
8 | end |
9 | end ) |
If someone could help me, that would be greatly appreciated.
1 | script.Parent:GetPropertyChangedSignal( "Text" ):Connect( function () |
2 | local txt = script.Parent.Text |
3 | local chars = string.len(txt) |
4 | script.Parent.Parent.MaxCharacter.Text = chars.. " / 42" --Shows the current characters of the text. |
5 |
6 | if chars < 42 then --That's the less than sign should be ">". |
7 | txt = txt:sub( 1 , 42 ) |
8 | end |
9 | end ) |
wow i am bad