MtnMCG

Untitled

Sep 2nd, 2024
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. -- Password for the door
  2. local password = "1616"
  3.  
  4. -- Function to open the door
  5. local function openDoor()
  6. redstone.setOutput("front", true)
  7. sleep(2)
  8. redstone.setOutput("front", false)
  9. end
  10.  
  11. -- Main loop
  12. while true do
  13. term.clear()
  14. term.setCursorPos(1,1)
  15. print("Enter password:")
  16.  
  17. -- Read user input
  18. local input = read("*")
  19.  
  20. -- Check if password is correct
  21. if input == password then
  22. print("Access granted!")
  23. openDoor()
  24. else
  25. print("Access denied!")
  26. end
  27.  
  28. sleep(2)
  29. end
Advertisement
Add Comment
Please, Sign In to add comment