Advertisement
GDragonArcher

open door

Apr 22nd, 2023 (edited)
1,049
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.52 KB | None | 0 0
  1. -- this code will automatically send a redstone signal when a player is nearby
  2. -- useful for auto opening doors when a player is near
  3.  
  4. local detector = peripheral.find("playerDetector") -- Finds the peripheral if one is connected
  5. if detector == nil then error("playerDetector not found") end
  6.  
  7. redstone.setOutput("back", true)    -- set door to closed on startup
  8.  
  9. while true do
  10. if detector.isPlayersInRange(15) == true then
  11.     redstone.setOutput("back", false)
  12.  
  13. else
  14. redstone.setOutput("back", true)
  15.  
  16.     end
  17.  
  18.  
  19. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement