# Help me please!!!! ;(

**URL:** https://discussions.unity.com/t/help-me-please/494517
**Category:** Scripting
**Tags:** Scripting
**Created:** [January 9, 2013, 4:32pm UTC](https://discussions.unity.com/t/help-me-please/494517 "2013-01-09T16:32:14Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![NewGameMaker](https://avatars.discourse-cdn.com/v4/letter/n/9fc348/32.png) [@NewGameMaker](https://discussions.unity.com/u/NewGameMaker)
#### Post date: [January 9, 2013, 4:32pm UTC](https://discussions.unity.com/t/help-me-please/494517/1 "2013-01-09T16:32:14Z")

</div>

I get these errors when im trying to make my sprint,walk,idle Script D:  
Assets/Scripts/Player.js(36,18): BCE0044: expecting ), found ‘=’.  
Assets/Scripts/Player.js(36,20): BCE0043: Unexpected token: 0.  
Assets/Scripts/Player.js(39,5): BCE0044: expecting :, found ‘}’.

Here is the full script

var PlayerState : float;  
var PlayerAnimSec : GameObject;

function Update ()  
{  
PlayerStateController();  
PlayerAnims();  
}

function PlayerStateController()  
{  
if ((Input.GetAxis(“Vertical”) !=0 || Input.GetAxis(“Horizontal”) !=0))

{  
if (Input.GetButton(“Sprint”))  
{  
PlayerState = 2;  
}  
else  
{  
PlayerState = 1;  
}  
}

else  
{  
PlayerState = 0;  
}  
}

function PlayerAnims()  
{

if (PlayerState = 0)  
{  
PlayerAnimSec.animation.CrossFade(“IdleAnimation”, 0.4)  
}

if (PlayerState = 1)  
{  
PlayerAnimSec.animation.CrossFade(“WalkAnimation”, 0.4)  
}

if (PlayerState = 2)  
{  
PlayerAnimSec.animation.CrossFade(“SprintAnimation”, 0.4)

}  
}

Help me pleaze!

---

<div class="post-metadata">

### Author: ![appels](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/appels/32/495192_2.png) [@appels](https://discussions.unity.com/u/appels)
#### Post date: [January 9, 2013, 4:40pm UTC](https://discussions.unity.com/t/help-me-please/494517/2 "2013-01-09T16:40:11Z")

</div>

Please use the code tags when posting code, it’s a pain to read code like that.  
You script is full of syntax errors :

```auto
#pragma strict

var PlayerState : float;
var PlayerAnimSec : GameObject;

function Update ()
{
PlayerStateController();
PlayerAnims();
}

function PlayerStateController()
{
if ((Input.GetAxis("Vertical") !=0 || Input.GetAxis("Horizontal") !=0))

{
if (Input.GetButton("Sprint"))
{
PlayerState = 2;
}
else
{
PlayerState = 1;
}
}

else
{
PlayerState = 0;
}
}

function PlayerAnims()
{

if (PlayerState == 0)
{
PlayerAnimSec.animation.CrossFade("IdleAnimation", 0.4);
}

if (PlayerState == 1)
{
PlayerAnimSec.animation.CrossFade("WalkAnimation", 0.4);
}

if (PlayerState == 2)
{
PlayerAnimSec.animation.CrossFade("SprintAnimation ", 0.4);

}
}

```

= should be ==  
and you forgot some ‘;’

---

<div class="post-metadata">

### Author: ![1HpLeft](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/1hpleft/32/483051_2.png) [@1HpLeft](https://discussions.unity.com/u/1HpLeft)
#### Post date: [January 9, 2013, 4:42pm UTC](https://discussions.unity.com/t/help-me-please/494517/3 "2013-01-09T16:42:43Z")

</div>

Hi

there is an error in you script : if (PlayerState = 0) should be if (PlayerState == 0)  
the same for the other if …

“=” mean assign  
“==” mean comparaison

too late …
