You could use ray cast to tell if there is something above the player and prevent the crouch input from going through