Animation Script Error

i get these errors: Assets/Assets/Run Animation.js(14,23): BCE0044: expecting :, found ‘;’.

Assets/Assets/Run Animation.js(12,34): UCE0001: ‘;’ expected. Insert a semicolon at the end.

Assets/Assets/Run Animation.js(12,1): BCE0043: Unexpected token: if.

function Update () 

{       

if (Input.GetKeyDown("d")) {

animation.Play("Run");
}

{       

if (Input.GetKeyUp("d")) {

animation.Play("Idle");
}
}

1 Answer

1

At line 10, you have to get rid of the opening brace. This should compile:

function Update () 
 
{       
 
if (Input.GetKeyDown("d")) {
 
animation.Play("Run");
}
 
if (Input.GetKeyUp("d")) {
 
animation.Play("Idle");
}
}

thank you!, im not that great at finding what causes the errors in some of my scripting.