Player cannot stop moving after key released!

I want to make my player move only using “WASD” , so I have this script:

void FixedUpdate()
    {
        //float moveHorizontal = Input.GetAxis("Horizontal");
        //float moveVertical = Input.GetAxis("Vertical");
        if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.S))
        {
            float moveHorizontal = Input.GetAxis("Horizontal");
            float moveVertical = Input.GetAxis("Vertical");
            Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
            rb.velocity = movement * speed;
        }
        if(Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.D))
        {
            float moveHorizontal = Input.GetAxis("Horizontal");
            float moveVertical = Input.GetAxis("Vertical");
            Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
            rb.velocity = movement * speed;
        }
}

The player moves when I hit “WASD” but when I, say, I hit “W”, it’ll just keep moving forward itself even after I realeased the key. I’m not talking about the " GetAxis " soomthing effect here, I’m saying the player will move at the same speed on its own forward…

Please help! Thanks in advance!

You should just remove the if statements and the whole part inside KeyCode.A and KeyCode.D statement since it is the same thing. If you keep all statements, then who applies the velocity when all the keys are released? That is right, no one.

Given that you have a non-standard control scheme, wouldn’t it be easier to just change your axis definitions to suit? since the arrow keys aren’t actually controlling Horizontal and Vertical?