How do I make a 2d-rigidbody stop moving as soon as I let go of my movement key

I am making a 2d type game(like hollow knight), and i want my rigidbody to stop as soon as I let go of my movement key. How would I do that? Thank you!

You use GetKeyUp and then set velocity to 0.