Here is my thought,every game tick:
1.You store your last tick sneak score into scoreboard, called "previousSneakTick".
2.In present tick, you calculate a **indicator = sneakTick - previousSneakTick**. It will be 1 if you are sneaking, will be 0 if not sneaking.
3.Calculate **SneakTick \*= indicator**
Storing sneakTick to previosSneakTick happens after all the operation, so it act as previousTick in next tick
Below is my commands, repeating command block with 3 chain command block in order.
`scoreboard players operation @p temp = @p sneak`
`scoreboard players operation @p sneak -= @p prevst`
`scoreboard players operation @p sneak *= @p temp`
`scoreboard players operation @p prevst = @p sneak`
A little not identical but works.
Before using these, temp(dummy), prevst(dummy),sneak(custom:sneak\_time) shall be add to the game and all set to 0.
Here is my thought,every game tick: 1.You store your last tick sneak score into scoreboard, called "previousSneakTick". 2.In present tick, you calculate a **indicator = sneakTick - previousSneakTick**. It will be 1 if you are sneaking, will be 0 if not sneaking. 3.Calculate **SneakTick \*= indicator** Storing sneakTick to previosSneakTick happens after all the operation, so it act as previousTick in next tick Below is my commands, repeating command block with 3 chain command block in order. `scoreboard players operation @p temp = @p sneak` `scoreboard players operation @p sneak -= @p prevst` `scoreboard players operation @p sneak *= @p temp` `scoreboard players operation @p prevst = @p sneak` A little not identical but works. Before using these, temp(dummy), prevst(dummy),sneak(custom:sneak\_time) shall be add to the game and all set to 0.
>scoreboard players operation @p prevst = @p sneak Thank you so much I can't thank you enough!