Advertisement
kk258966

PlayerDetector

Dec 17th, 2023
700
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.48 KB | None | 0 0
  1. local detector = peripheral.find("playerDetector")
  2. if detector == nil then
  3.     error("playerDetector not in range")
  4. end
  5. function PlayerCheck()
  6.     return detector.isPlayersInRange(3)
  7. end
  8. while true do
  9.  
  10.     if PlayerCheck() == true then
  11.         redstone.setOutput("top",true)
  12.     else
  13.         redstone.setOutput("top", false) --This one just turns the redstone signal off so it's not kept on after the player leaves
  14.         print("Nope.\n")
  15.     end
  16. sleep(0)
  17. end
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement