Enemy AI Problemz

Hey forum just posting about a problem im having with my ai. I found this code off the forums and was trying to solve it myself but no luck. What is wrong is the zombie image is attached to a cube and it keeps rotating so im able to see the sides and, it is also flying so gravity is not affecting unless I attach a character motor to it. but if I do that then it disappears from the game when I start.

` var Player : Transform;
var MoveSpeed = 4;
var MaxDist = 10;
var MinDist = 5;

function Start ()
function Update ()
if(Vector2.Distance(transform.position,Player.position) >= MinDist){
transform.position += transform.forward*MoveSpeed*Time.deltaTime;
if(Vector2.Distance(transform.position,Player.position) <= MaxDist)
//Here Call any function U want Like Shoot at here or something

any help would be appreciated greatly even information on building code is usefull even though I have watched and read hundreds of videos and books and still not have gotten down how to program simple scripts

For zombie sprite problem:
I think you have to make the sprite into a child GameObject. And write a script to make it always look at the main camera.

For physics:
I think you better learn to use Unity default physics system unless your physics system is as simple as space invader. CharacterController and Rigidbody also works in your case. Remember that you have to add collider in the ground GameObject, or your game object will keep falling. Also it’s not good to use transform.position to move GameObject if you use its physics system. CharacterController has functions Move() and SimpleMove(). Rigidbody has function MovePosition(). (Go check the documentation)