Player can only move one direction when moving

My player can only move one direction when I press a key down. For example, when I try to press another key like left while I’m pressing the up key it doesn’t go in between or something like that.

void Update ()
{
    float horAxis = Input.GetAxis("Horizontal");
    float verAxis = Input.GetAxis("Vertical");

    Vector3 verMove = new Vector3(horAxis, 0, verAxis * moveSpeed);
    Vector3 horMove = new Vector3(horAxis * moveSpeed, 0, verAxis);

    if (Input.GetKey(KeyCode.UpArrow))
    {
        rb.velocity = verMove;
    }

    if (Input.GetKey(KeyCode.DownArrow))
    {  
        rb.velocity = verMove;
    }

    if (Input.GetKey(KeyCode.LeftArrow) )
    {
        rb.velocity = horMove;
    }

    if (Input.GetKey(KeyCode.RightArrow))
    {
        rb.velocity = horMove;
    }
}

The way your movement is set is just a little bit incorrect and I would recommend doing it this way.

Also, you should use Time.DeltaTime so if players have different amount of FPS they don’t move faster or slower (Update refreshes every frame, so if it refreshes more times, that gives more speed, Time.DeltaTime fixes that): Unity - Scripting API: Time.deltaTime.

By the way, if you want to learn a little bit of how this works you can see in the official Unity API: Unity - Scripting API: Input.GetAxis. Hope this helps

[SerializeField] private float speed;
private Vector2 input;
private Rigidbody rb;

private void Start()
{
    rb = GetComponent<Rigidbody>();
}

private void Update()
{
    input.x = Input.GetAxis("Horizontal");
    input.y = Input.GetAxis("Vertical");
    Vector3 finalInput = new Vector3(input.x, 0f, input.y);

    //You can use any of this ones
    rb.MovePosition(finalInput * speed * Time.deltaTime);

    rb.velocity = finalInput * speed * Time.deltaTime;
}

This works! however, when I use

rb.velocity = finalInput * speed * Time.deltaTime;

the character skips forward a little bit in the direction I’m moving sometimes.