Top Down Player Keeps Speed After Key Is Released

I’m working on a top down game that is similar to the combat in Undertale. The twist is the player runs out of stamina when they go in a certain direction for long enough. I copied a top down movement script from online, and did my best to manipulate it to make the player stop moving when they run out of stamina for that certain direction. I’ve run into a problem where the player will keep their momentum if the player just taps a certain direction. I’m not sure if the problem has to do with my movement script or the way my rigidbody is set up. My player is dynamic, has a gravity scale of 0, and is freezed on the z axis.

So I guess the main question is:

How do I make the player stop moving when that direction isn’t being inputted?

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

public class PlayerMovement : MonoBehaviour
{
    public float moveSpeed;
    public Rigidbody2D rb;
    private Vector2 movenput;

    public GameObject SliderUp;
    public GameObject SliderDown;
    public GameObject SliderRight;
    public GameObject SliderLeft;
    public float decreaseSpeed;
    public float regainSpeed;

    private void RegainStam()
    {
        if (SliderRight.transform.localScale.x < 2.6f)
        {
            if (Input.GetKey("right") == false)
            {
                SliderRight.transform.localScale += new Vector3(regainSpeed, 0, 0);
            }
        }

        if (SliderLeft.transform.localScale.x < 2.6f)
        {
            if (Input.GetKey("left") == false)
            {
                SliderLeft.transform.localScale += new Vector3(regainSpeed, 0, 0);
            }
        }
        if (SliderUp.transform.localScale.x < 2.6f)
        {
            if (Input.GetKey("up") == false)
            {
                SliderUp.transform.localScale += new Vector3(regainSpeed, 0, 0);
            }
        }
        if (SliderDown.transform.localScale.x < 2.6f)
        {
            if (Input.GetKey("down") == false)
            {
                SliderDown.transform.localScale += new Vector3(regainSpeed, 0, 0);
            }
        }
    }
    private void StopMovement()
    {


        if (Input.GetKey("right"))
        {
            movenput.x = Input.GetAxisRaw("Horizontal");
            
            if (SliderRight.transform.localScale.x <= 0f)
            {
                movenput -= new Vector2(1, 0);
            } 
           
        }
        if (Input.GetKey("left"))
        {
            movenput.x = Input.GetAxisRaw("Horizontal");
            if (SliderLeft.transform.localScale.x <= 0f)
            {
                movenput += new Vector2(1, 0);
            }
        }
        if (Input.GetKey("down"))
        {
            movenput.y = Input.GetAxisRaw("Vertical");
            if (SliderDown.transform.localScale.x <= 0f)
            {
                movenput += new Vector2(0, 1);
            }
        }
        if (Input.GetKey("up"))
        {
            movenput.y = Input.GetAxisRaw("Vertical");
            if (SliderUp.transform.localScale.x <= 0f)
            {
                movenput -= new Vector2(0, 1);
            }
        }
    }

    void Start()
    {

    }

    void Update()
    { 
        
   
        movenput.Normalize();

        rb.velocity = movenput * moveSpeed;

        RegainStam();
        StopMovement();

        if (Input.GetKey("right"))
        {
            if (SliderRight.transform.localScale.x >= 0.0001f)
            {
                SliderRight.transform.localScale -= new Vector3(decreaseSpeed, 0, 0);
            }

        }
        if (Input.GetKey("left"))
        {
            if (SliderLeft.transform.localScale.x >= 0.0001f)
            {
                SliderLeft.transform.localScale -= new Vector3(decreaseSpeed, 0, 0);
            }

        }
        if (Input.GetKey("down"))
        {
            if (SliderDown.transform.localScale.x >= 0.0001f)
            {
                SliderDown.transform.localScale -= new Vector3(decreaseSpeed, 0, 0);
            }

        }
        if (Input.GetKey("up"))
        {
            if (SliderUp.transform.localScale.x >= 0.0001f)
            {
                SliderUp.transform.localScale -= new Vector3(decreaseSpeed, 0, 0);
            }

        }
    }


}

You can stop your player when you let go of a key using Input.GetKeyUp, I think that will work for you.