what engine did you use? A state machine might help you with crouching in the future.
I used Unity. I found a way of doing it now, somewhat but still have to put it to the test.