local im=peripheral.find("inventoryManager") or error("No IM") local c="up" local s=0 local d=0.5 while true do os.pullEvent("redstone") local b=false while redstone.getInput("top") do if im.removeItemFromPlayer(c,{fromSlot=s}) then b=true end sleep(d) if b and redstone.getInput("top") then im.addItemToPlayer(c,{toSlot=s,count=64}) b=false sleep(d) end end if b then im.addItemToPlayer(c,{toSlot=s,count=64}) end end