Everytime I create a script, even if its exactly like a script from the Scripting Manuel it always tell me "Expected “;” Insert a semicolon at the end. Problem is there is already one there. What do I do?
function Update ()
{
if (transform.position.y < -200)
{
transform.position.y = 200;
transform.position.x = 0;
transform.position.z = 0;
}
}
brackets are a bit wrong and one semicolon too many
Its a simple Out-of-bounds respawn script. Since I’m new to scripting, I still don’t quite understand all of it.
Here is the error.
Assets/Scripts/Respawn.js(8,9): BCE0044: expecting EOF, found ‘}’.
For future reference, here was the poroblem code:
function Update ()
{
if (transform.position.y < -200);
}
transform.position.y = 200;
transform.position.x = 0;
transform.position.z = 0;
}
}
and here it is corrected:
function Update ()
{
if (transform.position.y < -200)
{
transform.position.y = 200;
transform.position.x = 0;
transform.position.z = 0;
}
}
Note the removed semicolon, and the flipped bracked on line three and four respectively.