Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Define the password
- local password = "1234"
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("Enter password:")
- -- Read the input from the user. The typed password will be hidden.
- local input = read("*")
- -- Check if the entered password is correct
- if input == password then
- -- If the password is correct, emit a redstone signal
- redstone.setOutput("back", true)
- print("Access granted.")
- os.sleep(2) -- Keep the door open for 2 seconds
- -- Turn off the redstone signal
- redstone.setOutput("back", false)
- else
- -- If the password is incorrect, display an error message
- print("Access denied.")
- os.sleep(2)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment