Advertisement
MadScience2728

PlayerSensor

Mar 10th, 2021
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. local sensor = peripheral.wrap("left")
  2.  
  3. function Get()
  4. local players = sensor.getNearbyPlayers(10)
  5. local count = 0
  6. for key,value in pairs(players) do
  7. count = count + 1
  8. end
  9. print("Found " .. tostring(count) .. " players")
  10. return count
  11. end
  12.  
  13. while true do
  14. if Get() > 1 then
  15. rs.setAnalogOutput("back", 15)
  16. else
  17. rs.setAnalogOutput("back",0)
  18. end
  19. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement