How can I stop the velocity of an object in movement when I touch it?

I´m not an expert on swipe controllers, so I decided to find a tutorial on internet. It also worked, but I need to change the player velocity to 0 when i touch it while is moving, I consider that needs a double conditional, but i don´t know how to use it. I hope that someone can help me with that problem.

there is the script example:

public class SwipeScript2 : MonoBehaviour
{

Vector2 startPos, endPos, direction;
Rigidbody2D myRigidbody2D;
public float shootPower = 10f;

void Start()
{
    myRigidbody2D = GetComponent<Rigidbody2D>();
}

void OnMouseDown()
{
    if (Input.GetMouseButtonDown(0))
    {
        startPos = Input.mousePosition;
    }
}

void OnMouseUp()
{
    if (Input.GetMouseButtonUp(0))
    {
        endPos = Input.mousePosition;
        direction =startPos - endPos;
        myRigidbody2D.isKinematic = false;
        myRigidbody2D.AddForce(-direction * shootPower);
    }
    else
    {
        myRigidbody2D.AddForce(new Vector2(0, 0));
    }
}

}

myRigidbody2D.velocity = Vector2.zero