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

How do I make a passcode script inside a gui that opens a frame if correct?

I've search the ROBLOX wiki but they don't seem to have what I am looking for. I would like a script/local script that when the numbers 5029 are entered it opens a new frame named 'follow' if incorrect it will change 'progress' (a textbox) text to say Incorrect

The textbox is named code.The textbox is in 'Frame' which is in the frame 'p5' which is in 'Frame' Which is in 'Frame' which is in 'Screen GUi' I only need help with this I can add the additional infomation of text box changing colour within text etc. Thank you!

2 comments

0

I need a little more information. Do you already have a script? And if you do, is it a local script? Also, I'd appreciate if you rewrote this. It's a little confusing. Thanks!

0

Learn basic Lua.

1 answer

✓ Accepted answer

Before posting a question I suggest you learn the basics. This site is not a request site as well, though you are lucky that I will be helping.

Well if you don't have anything down then here are some steps;

  1. Add a ScreenGui inside of PlayerGui
  2. Make sure you have a TextBox inside of the new ScreenGui
  3. Make sure you know what Frame you want to open and make sure it's named
  4. Add a TextButton you can call it Submit, Enter whatever
  5. Add a LocalScript Inside of the SubmitButton or EnterButton (the button you added)
  1. Type in this code;
local code = 'YourCode' --This is the code the player has to enter
local SB = script.Parent --Submit Button
local F = --Add the location of the frame here
local Bar = script.Parent.Parent:WaitForChild('TextBox') --Change to correct name if you have one

SB.MouseButton1Down:Connect(function() --Fires when submit button is clicked
	if Bar.Text == code then --If the bar's text is the same as code 
		F.Visible = true --Make the frame visible
	else --If the code is anything else
		return --Returns and ends the code
	end
end)

Now I have explained what each line does so you should study them. If this helped then please click 'Accept Answer' below.

16 comments

0

When It says location would that be: ScreenGui.Frame.Frame.p5.Frame ?

0

Depends where the frame is, if the frame is in the Screen Gui in another frame in another frame in this thing called P5 in another frame the yes

0

Also, If u want everything visible then just do ScreenGui.Frame.Visible = true

0

Where does this script go?

0

Test around, btw please accept answer. (I was going to moderate this but then I was like nah)

0

Script goes inside of the enter button

0

Okay Thank you I'm accepting now.

0

Thanks

0

Good luck with your game. I'm not sure what u mean though.

0

Just make sure you got the variables right, everything else will work just fine

0

Wait so the frame my enter button and text box are located are ScreenGui.Frame.Frame.p5.Frame. the script is located in submit. The script is currently not working.

0

screengui is underlined blue

0

You know you should just make a question with your errors because I have no idea where the objects are placed. It's hard communicating from comments. Also, you can learn how to define variables

0

okayyy

0

Everything is working now. Didnt have to make another question. Thank you for helping me.

0

No problem!

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