How to set the speed to 0

I want to make an attack animation, but when i play the animation while running the player is still moving. I tried to change rigidbody’s velocity and more but nothing seemed to help. So how could i stop the player when the attack animation is playing?

I would think that you could achieve this through States. And when you’re attacking, the player would be in a “fighting” state. While in this fighting state, try this:

Rigidbody2D rb2d; rb2d = GetComponent(); rb2d.velocity = new Velocity2(0f, 0f);.

And then switch back to “idle” state or whatever other state after the attackin animation is finished.
From the comments, it looks like you’re moving a dynamic rigidbody2D; is that correct?
,You could use States and have the rb2d.velocity = new Vector2 (0f, 0f); when the character is in attacking State.

Based on the comments, it looks like this is a dynamic body; is that correct? Have you tried something like this, yet?