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
Your error is in line 24, like the error message says. You are doing 1 too many ".parent"s. ".Parent" Goes to the TextBox, and another ".Parent" goes to the frame.
New Code Line 24
script.Parent.TextLabel.Visible = true
All 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.TextLabel.Visible = false if script.Parent.Text == "Testing1" then script.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)