Player typing in TextBox does not change the Text Properties

I am trying to make a game where the player fills in 2 TextBoxes and click a button and then it gives them a custom answer that I can edit in. But the Text Properties are not changing when the player fills in the 2 TextBoxes. Here is the code:

local player = game.Players.LocalPlayer
local screenGui = player:WaitForChild("PlayerGui"):WaitForChild("ScreenGui")
local textBox1 = screenGui:WaitForChild("TextBox1")
local textBox2 = screenGui:WaitForChild("TextBox2")
local enterButton = screenGui:WaitForChild("Enter")
local answerLabel = screenGui:WaitForChild("Answer")

local customAnswer = "success"

enterButton.MouseButton1Click:Connect(function()
    local text1 = string.lower(textBox1.Text)
    local text2 = string.lower(textBox2.Text)
    
    if text1 == "test" and text2 == "Test" then
        answerLabel.Text = customAnswer
    else
        answerLabel.Text = "error"
    end
end)

Change Test to test in text2 == "Test". Since you used string.lower() on text2.Text (which turns every letter in the string lowercase), the string Test is impossible to get, since Test has an uppercase T in it. That means text2 == "Test" will always returns false, so answerLabel won’t show the custom message.

1 Like

nvm it works (characters long)