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:
script.Parent:GetPropertyChangedSignal("Text"):Connect(function()
local txt = script.Parent.Text
local chars = string.len(txt)
script.Parent.Parent.MaxCharacter.Text = chars.." / 42" --Shows the current characters of the text.
if chars < 42 then
txt = txt:sub(1,42)
end
end)
If someone could help me, that would be greatly appreciated.

2 comments
FireSam , Im assuming you want your amount of max character for your text box is 42? am I correct ?
I figured that would be it