Jan 19th, 2021
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local side = "left" -- Change left to whatever side your door / redstone is on, E.G: left, right, front, back, bottom, top. Be sure to leave the "s around it, though
  2. local password = "bacon" -- Change bacon to what you want your password to be. Be sure to leave the "s around it, though
  3. local opentime = 5 -- Change 5 to how long (in seconds) you want the redstone current to be on. Don't put "s around it, though
  4. while true do
  5.  term.clear() -- Clears the screen
  6.  term.setCursorPos(1,1) -- Fixes the cursor position
  7.  write("Password: ") -- Prints 'Password: ' to the screen
  8.  local input = read("*") -- Makes the variable 'input' have the contents of what the user types in, the "*" part censors out the password
  9.  if input == password then -- Checks if the user inputted the correct password
  10.   term.clear() -- Already explained up top
  11.   term.setCursorPos(1,1)
  12.   print("Password correct!") -- Prints 'Password correct!' to the screen
  13.   rs.setOutput(side,true) -- Output a redstone current to the side you specified
  14.   sleep(opentime) -- Wait the amount of seconds you specifed, then..
  15.   rs.setOutput(side,false) -- Stop outputting a redstone current
  16.  else -- Checks if the user didn't input the correct password
  17.   print("Password incorrect!") -- Prints 'Password incorrect!' to the screen
  18.   sleep(2) -- Waits 2 seconds
  19.  end
  20. end
RAW Paste Data