Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0

Password door program accepts anything as correct


Hello, I'm quite new to lua and I've been working on fixing this code all day but I just cannot figure it out!
Whenever the program is opened it shows what it's supposed to:
Attempts: 0/3

However whenever something is inputted as a password and is incorrect it does not add +1 to attempts and activates the first if statement

Here is the code:



Share this post

Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0
17 minutes ago, BrisingrAerowing said:

You're reading into a variable called i, but are comparing a variable called input. Also the password needs to be surrounded by quotation marks (").

Would I need to remove I = io.read()

and instead of a double == I would have = correct?

Share this post

Link to post
Share on other sites
  • 0

So for this you either need to change

i = io.read()


input = io.read()


or you can change

if input == pass then


if i == pass then


Right now you are storing your variable as a different way than you are accessing it (in your if statement), so you need to make them the same,

And then as others are saying your password needs to be surrounded in quotation marks, so line 2 needs to become

pass = "tama"


Hope I could help!


Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.