Enemy reorienting for player

Hi guys, in this code my gameobcjet is reorienting to player positin.
I am trying to use the script on 2D game, and i need the object reorienting only the X axis.

Because with Y reoriententaion it will be like a flutuable gameobject.

Can anyone help me here??

Thanks!

var player: GameObject;
    var rotVel : float ;
    var transVel : float;
    
    
    function Update () {
    
    
    
    	rotVel = 1;
    	transVel = 2;
    
    	Aproximar ();
    }
    
    
    function Aproximar ()
    {
    	
    	
    
    	var dir : Vector3 = player.transform.position - transform.position;		
    	
    	// Reorient NPC towards it
    	transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(dir), Time.deltaTime * rotVel);
    	transform.eulerAngles = new Vector3(0, 0, 0);
    		
    	
    	
    	if (dir.magnitude <= 2)
    	{
    		rigidbody.velocity = Vector3.zero;
    		
    	}
    	else
    	{
    		rigidbody.velocity = dir.normalized * transVel;	
    	}
    
    	
    }

You might want to check out this post: Enemy Follow Disable Y Axis - Questions & Answers - Unity Discussions