So I’m trying to make it so if the player hasn’t typed anything into the textbox, it’ll appear some sort of error message where it tells you to type, but idk how to do so.
This is my script right here:
(I just need the coding for the detection,I’m fine with the other coding/actions)
local Suggestion = SuggestionBox
local Submit = Submit button
if Suggestion.Text == "" then
Error:play()
Submit.BackgroundColor3 = Color3.fromRGB(252, 0, 6)
else
Submit.BackgroundColor3 = Color3.fromRGB(123, 200, 255)
end
now whenever I type something the error message appears instead.
I want to make so when the player types nothing and presses submit,THEN the error message appears
local box = -- textBox
local submit = -- submit button
submit.MouseButton1Click:Connect(function()
if box.Text ~= "" then
-- submit
else
print("You have to type something.")
end
end)
~= means not equal. Essentially, we check if the text inside the texbox is not equal to nothing at all. If it is not equal to literally nothing, we know there is some text and we can submit.