Errors with script using Javascript.

I am getting the following errors with the script at the bottom of this post, But I posted a similar question last night, which got a few responses on how to fix it, but the one i chose, didn’t fix my issues.

Assets/Slender.js(33,1): BCE0044: expecting }, found ‘’.
Assets/Slender.js(16,17): UCE0001: ‘;’ expected. Insert a semicolon at the end.
Assets/Slender.js(16,16): BCE0043: Unexpected token: …

SCRIPT

var playerTarget : Transform;// Target of Slender
var speed : int = 5;
var rotationSpeed : float = 2.5;
var slenderPosition : Transform;// Slender's Current Position
 
function Awake () {
slenderPosition = transform;
}
 
function Start () {
playerTarget = GameObject.FindWithTag("Player").Transform;
}
 
function Update () {
slenderPosition.rotation = Quaternion.Slerp(slenderPosition.rotation, Quaternion.LookRotation(playerTarget.position - slenderPosition.position) , rotationSpeed*Time.deltaTime
slenderPosition.position += slenderPosition.forward * speed * Time.deltaTime;

}

2 Answers

2

You need to change this line:

slenderPosition.rotation = Quaternion.Slerp(slenderPosition.rotation, Quaternion.LookRotation(playerTarget.position - slenderPosition.position) , rotationSpeed*Time.deltaTime

To add closing parentheses and a semi-colon at the end, like so:

slenderPosition.rotation = Quaternion.Slerp(slenderPosition.rotation, Quaternion.LookRotation(playerTarget.position - slenderPosition.position) , rotationSpeed*Time.deltaTime);

Keep in mind the numbers after the filename: (16, 17). They let you know what code lines to look at.

What he said. I 2nd his response/answer. Always try to check the numbers as they tell you what line the error was found on. At least it’s only a typo…