I'm using a climbing command that gives you levitation until you touch a block of air. I wanted to know if there was a way in which I can cancel this effect with shift or any other way because sometimes I get stuck in places.
I think that is because it doesn't read the air blocks, but I don't know how to stop that without completely removing the effect.

  • 1
    Welcome to Arqade! You could add the command you are using.
    – pinckerman
    Commented May 8, 2023 at 23:14

1 Answer 1


First create a scoreboard to detect when the player is sneaking:

/scoreboard objectives add shift minecraft.custom:minecraft.sneak_time

Then you need a repeating command block and a chain command block (or you can use a datapack function, but that's more complicated). Make sure the (purple) repeating command block is pointing towards the (green) chain command block and the chain command block is pointing in the same direction (so away from the repeating command block).

In the (purple) repeating command block put this command:

/effect clear @a[scores={shift=1..}] minecraft:levitation

In the (green) chain command block put this command:

/scoreboard players set @a shift 0

Make sure both command blocks are set to always active.


The first command creates a scoreboard objective to track when players press the shift button. The second command removes the levitation from all players who are sneaking, using the scoreboard. The third command resets the scoreboard so that the system can work more than once.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .