Could someone help me fix this code?

It is supposed to change the animation of an enemy I have depending on where he is relative to the Player meaning which direction he is moving, but it says I cannot convert " UnityEngine.Transform" to “Unity Engine.Vector3”

using UnityEngine;
using System.Collections;

public class ZombieAnimation : MonoBehaviour {

private Vector3 Player;
private float Xdif;
private float Zdif;

public Animator anim;

void Start () {
	anim = GetComponent<Animator>();
	Player = GameObject.Find ("Player").transform;

	Xdif = Player.x - transform.position.x;
	Zdif = Player.z - transform.position.z;

void Update () {

	if (Zdif > 0) {
		anim.SetBool ("Left", true);
		anim.SetBool ("Right", false);
	if (Zdif < 0) {
		anim.SetBool ("Right", true);
		anim.SetBool ("Left", false);


The error message is pretty clear, you have a variable of type Vector3 called Player, and you’re trying to assign a variable of type Transform to it.

A fix for your code could be changing this line:

Player = GameObject.Find ("Player").transform;

to this:

Player = GameObject.Find ("Player").transform.position;

But consider using better names for variables, it looks like you’re using the Player variable to store the Player’s position, so it should be called “PlayerPosition” instead.