How to move an object straight based on another object?

UNITY 2D C#

My object moves in face direction.
How do I make my object move straight (what is doing now) and have the same position on the Y axis as the object named Player?

The Y position of the Player object is constantly changing because it is a movable object relative to the Y axis.

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

public class WaveShootFromRight : MonoBehaviour
{

	public float speed = 10.0f;
	private Rigidbody2D rb;
	private Vector2 screenBounds;


	public GameObject cam;

    // Start is called before the first frame update
    void Start()
    {
		rb = this.GetComponent<Rigidbody2D>();
		screenBounds = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, Camera.main.transform.position.z));

        
    }

    // Update is called once per frame
    void Update()
    {
		transform.position += transform.up *Time.deltaTime * speed;

    }
}

Lock the object’s y compononent of tranform.position to that of the player ?