- Home /
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;
}
Answer by hoy_smallfry · Apr 02, 2013 at 10:53 PM
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.
Answer by ransomink · Mar 18, 2014 at 11:14 PM
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...
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Problems with java script. 1 Answer
Script error help ? 1 Answer