Enemy walking above ground

Hi there!

So my problem is that my enemy which is a zombie is walking above the ground when he wants to chase me… here’s my script for my enemy :

var target : Transform; //the enemy's target
var moveSpeed = 3; //move speed
var rotationSpeed = 3; //speed of turning

var myTransform : Transform; //current transform data of this enemy
var isNotDead : boolean = true;
var health : float = 100;
function Awake()
{
    myTransform = transform; //cache transform data for easy access/preformance
}

function Start()
{
     target = GameObject.FindWithTag("Player").transform; //target the player

}

function Update () {
	
	if(health < 1){
	
		isNotDead = false;
		animation.Play("die");
		Destroy(gameObject, 1);
	}
	
	if(isNotDead){
	
	    //rotate to look at the player
	    myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
	    Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);
	
	
	    
	    var distance = Vector3.Distance(target.position, myTransform.position);
	    if (distance < 3.0f) {
	        animation.Play("attack1");
	    }
	    else{   
	    	//move towards the player
	   		myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
	   		animation.Play("walk1");
	    }

	}
}

function ApplyDamage(dmg : float){

	health -= dmg;
audio.Play();
}

anyway there are bunch of animations set up to this enemy and i have freezed the x,y,z in the Rigidbody ( freeze position ) Please help me ASAP! Thanksss

Replace lines 31 and 32 by:

    //rotate to look at the player
    var dir = target.position - myTransform.position;
    dir.y = 0.0;
    myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(dir), rotationSpeed*Time.deltaTime);

For future posts, please format your code. After pasting, select your code and use the 101/010 button. I did it for you this time.