Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I check if a textbox has no characters in it?

I have a custom chatbar and I have an if statement, but I don't know exactly what code I need for it.

I've tried just about every page of the wiki and nothing.

For example:

if (chat doesnt have just '' or ' ') then
--do stuff
else
(run code)
end

2 answers

You would check the Text property of the TextBox or TextLabel, example;

local TextBox = --Define this.
if TextBox.Text == "" then 
elseif TextBox.Text ~= "" then
end

If this helps, please accept my answer, it gives us both rep!

The text property is used to determine what text is in a TextBox or TextLabel.

Your question is asking if you can determine if there's any text in a TextBox. Here's how you'd do it:

local textBox = --define textBox here

if textBox.Text ~= "" then --this checks to see if the TextBox's text is not blank, i.e. if there's any letters in it
--run code
end

This discussion is preserved as it was. New answers, comments, and votes are closed.