Code:
local textBox = script.Parent
local secretWord = "Testing1"
local colorNormal = Color3.new(1, 1, 1) -- white
local colorWrong = Color3.new(1, 0, 0) -- red
local colorCorrect = Color3.new(0, 1, 0) -- green
textBox.ClearTextOnFocus = true
textBox.Text = ""
textBox.Font = Enum.Font.Code
textBox.PlaceholderText = "Write the text here"
textBox.BackgroundColor3 = colorNormal
local function onFocused()
textBox.BackgroundColor3 = colorNormal
end
local function onFocusLost(enterPressed, inputObject)
if enterPressed then
local guess = textBox.Text
if guess == secretWord then
script.Parent.Parent.TextLabel.Visible = false
if script.Parent.Text == "Testing1" then
script.Parent.Parent.TextLabel.Visible = true
else
print("Test")
end
textBox.Text = "TestRight"
textBox.BackgroundColor3 = colorCorrect
else
textBox.Text = "TestWrong"
textBox.BackgroundColor3 = colorWrong
end
else
textBox.Text = ""
textBox.BackgroundColor3 = colorNormal
end
end
textBox.FocusLost:Connect(onFocusLost)
textBox.Focused:Connect(onFocused)
How the gui is placed: https://i.gyazo.com/b69941e3a9e752aa47b71c2a0c65e874.png

2 comments
Any errors?
14:17:16.461 - TextLabel is not a valid member of Frame 14:17:16.463 - Stack Begin 14:17:16.465 - Script 'Players.DevSeveral.PlayerGui.ScreenGui.Frame.Chatbox.LocalScript', Line 23 - function onFocusLost 14:17:16.466 - Stack End