It actually is enough to just toggle the flag because if the flag is toggled the mechanism that is used for holding you onto the block while you are sneaking is than usedYou basically want to simulate the player sneaking, so toggeling the flag for it is enough