How do I make command blocks that teleports players away from an area, like 2 blocks or so, repeatedly, when they don't have a specific item? I'm trying to make an adventure map that would require certain items to proceed to the next portion of the map.
I want the command blocks to search players inventory for a diamond. If they have a diamond nothing happens. If they do not have diamond it teleports the player backwards 2 blocks. The issue is the first block is a repeating block that searches the players inventory within 2 block range. The second block is a chain block for testforblock (repeating block) successcount:0. Third block tp's ~ ~ ~2. I want the teleport to happen once unless the player reenters the radius. As it is, it teleports infinitely backwards and I have to disable command blocks to fix it.