Parsing Error?

This script keeps giving this parsing error that says “Error CS8025 : Parsing Error”

Here is the script:

var target : Transform; //the enemy's target
var moveSpeed = 3; //move speed
var rotationSpeed = 3; //speed of turning
var range : float=10f;
var range2 : float=10f;
var stop : float=0;
var myTransform : Transform; //CURRENT TRANSFORM data of this enemy
function Awake()
{
    myTransform = transform; //cache transform data for easy access/preformance
}

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

function Update () {
    //rotate to look at the player
    var distance = Vector3.Distance(myTransform.position, target.position);
    if (distance<=range2 &&  distance>=range){
        myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
                                                Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);
    }
   
   
    else if(distance<=range && distance>stop){
       
        //move towards the player
        myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
                                                Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);
        myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
    }
    else if (distance<=stop) {
        myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
                                                Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);
    }
   
   
}

Thanks a lot!

If the error says “CS” that means you’re trying to use a C# script, but the code isn’t C#, it’s Unityscript.

–Eric

Wow! You replied fast. I will change the script so that it’s JS, and see if that fixes it. Thanks!

Fixed, thanks!