Could someone explain why it isnt working

im trying to make that when i hit the character limit in my textbox it will make text appear

the problem is that the text doesnt appear

local textbox = script.Parent.Frame.TextBox
local maxchar = script.Parent.Frame.MaxChar 

maxchar.Visible = false

textbox.Changed:Connect(function()
	textbox.Text = textbox.Text:sub(1,12)
end)

while true do
	if string.len(textbox.Text) == 12 then
		task.wait()
		maxchar.Visible = true
	end
end

Make sure that this is a local script. Also, I recommend moving the string.len into the TextBox.Changed Connection and getting rid of the while true do.

local textbox = script.Parent.Frame.TextBox
local maxchar = script.Parent.Frame.MaxChar 

maxchar.Visible = false

textbox.Changed:Connect(function()
	textbox.Text = textbox.Text:sub(1,12)
	if string.len(textbox.Text) == 12 then
		task.wait()
		maxchar.Visible = true
	else
		task.wait()
		maxchar.Visible = false
	end
end)
local textbox = script.Parent.Frame.TextBox
local maxchar = script.Parent.Frame.MaxChar 

maxchar.Visible = false

--instead of spam checking with a loop, we only check when the text changes
textbox:GetPropertyChangedSignal("Text"):Connect(function(text)
	if string.len(text) >= 12 then 
		maxchar.Visible = true 
		textbox.Text = text:sub(1, 12)
	else 
		maxchar.Visible = false 
	end
end)