You have some logic issues here.
If the player is sneaking this code is run both client and server side. Did you intend this to happen?