How would i make a duck function?

im making a platformer and im making a duck that you can do, the problem is, you can still move while ducking, how would i disable the walking function? i scripted it so you can use wasd and arrow keys to move. Thanks in advance!

i suggest to work with finite state machine.