Hello, I'm making a game for my friends. I created a TextBox. After entering "roblox" into it and pressing enter, I want frame to appear (Visible = true). The script is as localscript.
That's the script:
local textBox = script.Parent
local secretWord = "roblox"
local colorNormal = Color3.new(1, 1, 1) -- white
local colorWrong = Color3.new(1, 0, 0) -- red
local colorCorrect = Color3.new(0, 1, 0) -- green
-- Initialize the state of the textBox
textBox.ClearTextOnFocus = true
textBox.Text = ""
textBox.Font = Enum.Font.Code
textBox.PlaceholderText = "Put here your word!"
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 = "1 match was found"
textBox.BackgroundColor3 = colorCorrect
game.StarterGui.ScreenGui.Frame.Visible = true
---------- I was planning to have the script here.
else
textBox.Text = "no result found"
textBox.BackgroundColor3 = colorWrong
end
else
-- The player stopped editing without pressing Enter
textBox.Text = ""
textBox.BackgroundColor3 = colorNormal
end
end
textBox.FocusLost:Connect(onFocusLost)
textBox.Focused:Connect(onFocused)
i tried 3 hours to do it but failed: /
here is short film: https://streamable.com/5w1p69 Greetings KotyOceloty
