How to finish my else if statement?

i want to add an else statement at the end of my script but i’m kind of dooped on how to put it in and make it say false. it just comes up with expecting EOF

  1. #pragma strict

  2. var enabled : boolean;

  3. function Start () {

  4. }

  5. function Update () {

  6. if (Input.GetButtonDown(“Aim”))

  7. GetComponent(ThirdPersonController).enabled = false;

  8. print(“True”);

}
else {print(“False”);
)

I believe you have an unmatched { starting with the “else”. Try this:

function Update () { 
if (Input.GetButtonDown("Aim"))
{
	GetComponent(ThirdPersonController).enabled = false; 
	print("True");
} 
else 
{
	print("False"); 
}

Geez, horrible, next time please make sure you use the the “code block” to make your codelines easier readable… I just did it instead:

replace your code with this:

#pragma strict
var enabled : boolean;
function Start ()
{
}
function Update ()
{
    if (Input.GetButtonDown("Aim"))
    {
        GetComponent(ThirdPersonController).enabled = false; 
        print("True");
    }
    else
    {
        print("False");
    }
}

And here’s a little tip: always try to make your sourecode readible for you and others, if you need help but nobody can decypher what you coded, helping you would be really difficult.

That being said, it should work now, oh and BTW “expecting EOF” means nothing less than that the compiler expects that the function (in this case Update()) should End (you were having a ‘)’ instead of a ‘}’ bracket.

EOF = EndOfFunction

I hope I helped you out, have a good day.