How to write "if (var int = var int 2)" ?

Hello, I’m trying to create a counting effect on unity, There is my code

#pragma strict
    

static var Score : int = 0;
var fakescore : int = 0;
var scoreboard : GameObject;
    
function Update () {
    if (scoreboard.active)
    {
        fakescore += 1;
    }
    if (gameObject.active)
    {
        var t : TextMesh = scoreboard.GetComponent(TextMesh);
        t.text = fakescore.ToString();

        gameObject.GetComponent("Timer (Script)").active = false;

        if ( fakescore > Score){
            t.text = Score.ToString();
        }
    }
}

so, I want to do this;

If fakescore equals Score, Set TextMesh to “Score.ToString();” but code didn’t worked :frowning: So can anyone help me ?

in javascript:

 var x :int =0; 
 var y:int =0;
 if(x==y){ //do something }

The equal equal operator == compares if the two values are equal. A single equal = actually assigns the value incorrectly.

So what you want to do is something like this
f fakescore equals Score, Set TextMesh to "Score.ToString()

if(fakescore ==Score){
    t.text = Score.ToString();
}