Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local textBox = script.Parent.TextBox
- local Frame = script.Parent
- local secretWord = "1254"
- local colorNormal = Color3.new(1, 1, 1)
- local colorWrong = Color3.new(1, 0, 0)
- local colorCorrect = Color3.new(0, 1, 0)
- textBox.ClearTextOnFocus = true
- textBox.Text = ""
- textBox.Font = Enum.Font.Code
- textBox.PlaceholderText = "Введи секретное слово"
- 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
- textBox.Text = "Ответ верный"
- textBox.BackgroundColor3 = colorCorrect
- wait(4)
- Frame.Visible = false
- else
- textBox.Text = "Неверный ответ"
- textBox.BackgroundColor3 = colorWrong
- wait(4)
- Frame.Visible = false
- end
- else
- textBox.Text = ""
- textBox.BackgroundColor3 = colorNormal
- end
- end
- textBox.FocusLost:Connect(onFocusLost)
- textBox.Focused:Connect(onFocused)
Add Comment
Please, Sign In to add comment