Advertisement
gamer515

passwordlock

Apr 16th, 2023 (edited)
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | Gaming | 0 0
  1. -- Set password
  2. local password = "1234"
  3. local doorSide = "right" -- Replace with the side your door is connected to
  4.  
  5. -- Main program
  6. while true do
  7. -- Prompt for password
  8. io.write("Enter password: ")
  9. local input = io.read()
  10.  
  11. -- Check if password is correct
  12. if input == password then
  13. print("Password correct, unlocking door.")
  14. redstone.setOutput(doorSide, true)
  15. sleep(5) -- Keeps the door open for 5 seconds, adjust as needed
  16. redstone.setOutput(doorSide, false)
  17. break
  18. else
  19. print("Password incorrect, locking door.")
  20. redstone.setOutput(doorSide, false)
  21. end
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement