Text box not recognising question marks or slashes

For some reason, this text box I have does not recognize certain characters as actual characters, for example, question marks and slashes. When I do a printout of the number of characters, it says 0.

script.Parent.TextBox.FocusLost:Connect(function()
	print("Focus lost")
	print(#script.Parent.TextBox.Text)
	if #script.Parent.TextBox.Text > 0 then
		print("Text existing")
		if cooldown == false then
			--Cool stuff
		end
	end
end)

image

Pretty sure it won’t do that unless you split the characters/words up (whichever way you want to), since you’re looking for number of elements in a table/array with the # here.

How would I do it so it recognizes the characters then?

script.Parent.TextBox.FocusLost:Connect(function()
    local CharCount = string.split(script.Parent.TextBox.Text, "")
	print("Focus lost")
	print(#CharCount)
	if #CharCount > 0 then
		print("Text existing")
		if cooldown == false then
			--Cool stuff
		end
	end
end)

Try that

No change. Very strange.
image

Could you try printing TextBox.Text and return me what it prints?

I mistyped .Text as .text, please update if not done already, and try Juan’s idea.

Prints nothing

This means there’s no text on the TextBox, therefore it returns 0 since there’s 0 chars of text.

Hm. Then why is it printing nothing if I clearly typed something there?

Where is the script located in the explorer?

Depends.

If you are changing the TextBox.Text like this:

game.StarterGui.ScreenGui.TextBox.Text = "Hello"

It won’t be replicated to the player screen.

You should change it like this:

game.Players.PLAYERNAME.PlayerGui.ScreenGui.TextBox.Text = "Hello"

I know it all works fine because when I type anything else it works fine

Would you mind adding us to team create to help out? If not, we can work here too but team create would be faster as we’d have to ask less questions.

Maybe not the best idea since I’ve got lots of other stuff in that place and don’t want my stuff stolen <3

Maybe take this one thing into a new baseplate.

The problem isn’t my system in general, it’s just this text box. Here’s the full thing if it’ll help

local cooldown = false

script.Parent.TextBox.FocusLost:Connect(function()
	local CharCount = string.split(script.Parent.TextBox.Text, "")
	print("Focus lost")
	print(script.Parent.TextBox.Text)
	print(#CharCount)
	if #CharCount > 0 then
		print("Text existing")
		if cooldown == false then
			print("Not cooldown")
			game.ReplicatedStorage.RadioAssets.SendMessage:FireServer(script.Parent.TextBox.Text, "Global", script.Parent.Parent.Parent.SwitchMode.Radioing.Value)
			print("Here: "..script.Parent.TextBox.Text)

			script.Parent.TextBox.Text = ""

			cooldown = true

			delay(1.25, function()
				cooldown = false
			end)
		end
	end
end)

In that case, please answer this. Preferable through a screenshot.

image

Try using string.len():

script.Parent.TextBox.FocusLost:Connect(function()
	print("Focus lost")
	print(string.len(script.Parent.TextBox.Text))
	if string.len(script.Parent.TextBox.Text) > 0 then
		print("Text existing")
		if cooldown == false then
			--Cool stuff
		end
	end
end)