My script wont work? Code inside.

 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 ("Idle Animation");
	}
	else if (PlayerState == 1)
	{
	PlayerAnimSec.animation.CrossFade ("Walking Animation");
	}
	else if (PlayerState == 2)
	{
	PlayerAnimSec.animation.Play("Sprint Animation");
		}
	}

Assets/Playerstate.js(14,9): BCE0044: expecting ), found ‘{’.
Assets/Playerstate.js(25,9): BCE0044: expecting EOF, found ‘else’.

I don’t know what to do I’ve tried everything.

Support is for issues with unity itself, this belongs in scripting .

Sorry about that, could a mod move/lock this thread? I’m still wondering what’s up with my script :stuck_out_tongue:

I think:

//Line 13
if ((Input.GetAxis("Vertical") !=0  (Input.GetAxis("Horizontal") !=0))//Incorrect
if (Input.GetAxis("Vertical") !=0 || Input.GetAxis("Horizontal") !=0)//Correct

Also, I doubt having two consecutive Else statements is syntactically correct, you’ll probably have to rewrite lines 19-28.

Actually the second else belongs to the if on line 13, its just the indentation that is off, so other than the error on line 13 that you mentioned script seems fine…except for the alternative indentation

Yes you’re right, thanks EdgeT.