Answered by
4 years ago Edited 4 years ago
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
1 | script.Parent.TextLabel.Visible = true |
All Code
01 | local textBox = script.Parent |
03 | local secretWord = "Testing1" |
04 | local colorNormal = Color 3. new( 1 , 1 , 1 ) |
05 | local colorWrong = Color 3. new( 1 , 0 , 0 ) |
06 | local colorCorrect = Color 3. new( 0 , 1 , 0 ) |
08 | textBox.ClearTextOnFocus = true |
10 | textBox.Font = Enum.Font.Code |
11 | textBox.PlaceholderText = "Write the text here" |
12 | textBox.BackgroundColor 3 = colorNormal |
14 | local function onFocused() |
15 | textBox.BackgroundColor 3 = colorNormal |
18 | local function onFocusLost(enterPressed, inputObject) |
20 | local guess = textBox.Text |
21 | if guess = = secretWord then |
22 | script.Parent.TextLabel.Visible = false |
23 | if script.Parent.Text = = "Testing1" then |
24 | script.Parent.TextLabel.Visible = true |
28 | textBox.Text = "TestRight" |
29 | textBox.BackgroundColor 3 = colorCorrect |
31 | textBox.Text = "TestWrong" |
32 | textBox.BackgroundColor 3 = colorWrong |
36 | textBox.BackgroundColor 3 = colorNormal |
40 | textBox.FocusLost:Connect(onFocusLost) |
41 | textBox.Focused:Connect(onFocused) |