Force Stop A Player From Typing in a Text Box

Hello Developers,

What I want to achieve is plain and simple. I have made my own custom Roblox chat. Using a TextBox of course for the player to enter their message. Once the player enters a certain amount of characters in the TextBox, I want to force them to stop typing that way the message does not go outside of the chat box and so that other users do not have their screen invaded by a long message. I am not sure if there is a way to force the client to stop typing in the TextBox. If there is a way to do this, I know what to do to finish up my coding. Does anyone know if there is a way to do this?

local YourTextBox -- The Textbox

YourTextBox.Changed:Connect(function()
    YourTextBox.Text = YourTextBox.Text:sub(1,50) -- After 50chars it wont allow more
end)
1 Like