How to add a TextBox Input Counter?

Hello everyone :slight_smile:
I am trying to achieve the following:

  • limit TextBox input to 193 letters
  • any more letters will get removed instantly without any button clicks
  • a separate TextLabel displays how many letters are left to use

I could sadly not find any helpful posts on the DevForum, if you have a minute to help me out here I would appreciate that!

script.Parent.Changed:Connect(function()
	if string.len(script.Parent.Text) > 193 then
		script.Parent.Text = script.Parent.Text:sub(1,193)
	end
end)