Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make the frame visible after entering the correct password?

Asked by 3 years ago

I created a script that checks text in TextBox. I also created a script that allows you to close a window.

First 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
            -------I want the script to be 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)

and the shorter second one

script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Parent.Visible = false
end)

These two scripts are local scripts. I want the window to pop up after typing the correct phrase.

How do I make the frame visible after entering the correct password?

1 answer

Log in to vote
0
Answered by 3 years ago

Ok so, make a ScreenGui, Frame , TextBox and a TextButton, then put a script into the TextButton, and put this code:

Make sure the "Deprecated Objects Shown" by pressing alt+s then search "Deprecated Objects Shown" then check it.

local password = "Password"
script.Parent.MouseButton1Click:Connect(function()
    if
        script.Parent.Parent.PasswordBox.Text == password
    then
        script.Parent.Parent.Frame.Visible = true
    end

end)
0
the script doesn't work KotyOceloty 25 — 3y
0
Show me your explorer so i can see it WesleyAng_3 153 — 3y
0
You have in film KotyOceloty 25 — 3y
Ad

Answer this question