local hasCart = false local dector = peripheral.wrap("top") while (true) do if (dector.isPlayersInRange(5)) then hasCart = true elseif (hasCart) then hasCart = false redstone.setOutput("back", true) os.sleep(0.5) redstone.setOutput("back", false) end os.sleep(0.5) end