Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

3 comments

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

0

I mean that's why his Script doesn't work. The script you got as an answer ^

0

And so you learn, read about StarterGui here: https://developer.roblox.com/en-us/api-reference/class/StarterGui

1 answer

✓ Accepted answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.