how to move a gameobject only on the x axis?

I am trying to make a mobile game…
My problem is that it now moves on the x and y axis.
I only need the x axis, but I don’t know what to change to just move it on the x axis.

// Update is called once per frame
private void Update()
    if (Input.touchCount > 0)
        Touch touch = Input.GetTouch(0);
        touchposition = Camera.main.ScreenToWorldPoint(touch.position);
        touchposition.z = 0;
        direction = (touchposition - transform.position);
        rb.velocity = new Vector2(direction.x, direction.y) * movespeed;

        if (touch.phase == TouchPhase.Ended)
            rb.velocity =;


@noahbianhi in the 10th line simply say:
rb.velocity = new Vector2(direction.x, 0f)* moveSpeed;