How to stop player velocity completely

I have made a script that makes the character move. The problem is that the character is sliding around. I want to set velocity to 0 anytime the right buttons arent pressed. What line of could could do that. Thanks for any guidance and explaining. Herses the code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Movement : MonoBehaviour
{
    private bool moving;

    [SerializeField]
    Vector3 v3Force;

    [SerializeField]
    KeyCode keyPositive;

    [SerializeField]
    KeyCode keyNegative;

    void FixedUpdate()
    {
        if (Input.GetKey(keyPositive) || Input.GetKey(keyNegative))
        {
            moving = true;
        }
        else { moving = false; }

        if (moving)
        {
            if (Input.GetKey(keyPositive))
                GetComponent<Rigidbody>().velocity += v3Force;

            if (Input.GetKey(keyNegative))
                GetComponent<Rigidbody>().velocity -= v3Force;
        }
        else 
        {
            
        }
    }
}

GetComponent().velocity = Vector3.zero;

Should do it, in your else bit.

I’d maybe assign the Rigidbody in the Start rather than doing a GetComponent reference each time too.