Error BCE0077

So I am doing a flashlight for my game, and I want the feature to toggle the light on and off. But I get Error BCE0077 : It is not possible to invoke a expression of type ‘boolean’. My question is: what is wrong with my script? Have I done something wrong here?

Here’s my script :

var LightObj : GameObject;
var Status = true;


function Update () {

if(Input.GetKeyDown("f")){
if(Status == true){
 Status == false();
}

else

if(Status == false){
Status == true();

}

}






}

function CheckStatus () {

if(Status == true){
LightObj.Light.enabled = true;

}

else

if(Status == false){
LightObj.Light.enabled = false;

}


}

Did my answers help at all? Note, it's considered common courtesy to vote up a helpful answer, and/or mark an answer as the answer if you asked the question.

1 Answer

1

You are attempting to call false as if it were a function.

Just remove the parenthesis on line 9 and 15. You are also performing a conditional check in those lines rather than assignment. So you may want to fix that too. :wink:

Keith

Ok, so how do I fix the assignment thing?

Well, a conditional check is performed by ==, in this case the check is for equality. An assignment is performed by =, which assigns the operand to the right of the =, to the operand on the left. So just change the == to = in lines 9 and 15.

false is a value, like 4 is a value. So just as you can write X = 4 you can write Status = false;