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

How can I fix a Gui script? (Frame.Visible = true)

Asked by 3 years ago

Ok, a few days ago I asked a question on script helpers that was "How to make Frame appear on the screen? ( Visible = false)".A guy with the nickname "WesleyAng_3" answered my question.

He wrote this:

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)

So I did what he asked, but it didn't work I tried to correct the script for several hours and let it go.

The next day I asked a similar question, this time shorter and more specific, I also added a video. here is short film: https://streamable.com/5w1p69

And you know what happened? The SAME GUEST answered with the same question question as the previous one.And it didn't work either.Today I noticed that he commented to send him an explorer. After all, he had a movie.

So if he helps me solve the problem now, or someone else, I will approve the question and everyone will be happy.

**I also include a link to two questions.

https://scriptinghelpers.org/questions/118922/how-to-make-frame-appear-on-the-screen-visible-false

https://scriptinghelpers.org/questions/118906/how-do-i-make-the-frame-visible-after-entering-the-correct-password **

Ps.if he responds with the same answer again, I delete my account in roblox and script helpers.

Greetings KotyOceloty

0
It's because you for some reason have the Frame you want to make invisible, inside your TextBox. Move it so they have the same Parent Spjureeedd 385 — 3y
0
I mean that's why his Script doesn't work. The script you got as an answer ^ Spjureeedd 385 — 3y
0
And so you learn, read about StarterGui here: https://developer.roblox.com/en-us/api-reference/class/StarterGui Spjureeedd 385 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

On the TextBox script, put this:

local textBox = script.Parent
local secretWord = "roblox"
local colorNormal = Color3.fromRGB(255, 255, 255) -- white
local colorWrong = Color3.fromRGB(255, 0, 0) -- red
local colorCorrect = Color3.fromRGB(0, 255, 0) -- green
local frame = script.Parent.Parent.Frame

-- Initialize the state of the textBox
textBox.ClearTextOnFocus = true
textBox.Text = ""
textBox.Font = Enum.Font.Code
textBox.PlaceholderText = "Put here your password!"
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 = "Correct Password!"
            textBox.BackgroundColor3 = colorCorrect
            script.Parent.Parent.Frame.Visible = true
            wait(2)
            textBox.BackgroundColor3 = colorNormal
            textBox.Text = "Put here your password!"
        else
            textBox.Text = "Wrong password!"
            textBox.BackgroundColor3 = colorWrong
            wait(2)
            textBox.BackgroundColor3 = colorNormal
            textBox.Text = "Put here your password!"
        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 inside of closeWindow, add a LocalScript then put this:

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

remove the script on the frame it does nothing.

Ad

Answer this question