How to check how many letters are there in TextBox?

How do I check if the TextBox’s text have 6 letters and prevent player from entering more text?

To restrict a TextBox’ text to a maximum of 6 characters, you can use an approach such as this:

local textBox = script.Parent -- path to your TextBox
local MAX_LENGTH = 6; -- the maximum amount of characters in the textBox

local function UpdateTextBox()
    local currentText = textBox.Text
	if currentText:len() > MAX_LENGTH then -- only re-assign text on.Changed IF it's > max length, or else you can create an infinite loop.
	    local newText = currentText:sub(1, MAX_LENGTH) -- :sub(1,6) will grab everything between the 1st and 2nd index of the string, inclusive.
	    textBox.Text = newText

textBox:GetPropertyChangedSignal("Text"):Connect(UpdateTextBox) -- fire UpdateTextBox every time textBox.Text changes.