Script behaving too early

My script is behaving too early when clicked. Here’s my code:

 var targetScript : ChangeSprite;
 var AcceptInput : boolean = true;
 private static var score : int = 0;
 var guiScore : GUIText;
    
function Start ()
{
guiScore.text = "Score: 0";
}


function OnMouseDown () {
if(AcceptInput)
{
AcceptInput = false;
}

targetScript = GameObject.Find("Shape").GetComponent(ChangeSprite);


GameObject.Find("Shape").GetComponent(ChangeSprite).enabled = true;
Debug.Log("Clicked");

if(targetScript.spriteRenderer.sprite == targetScript.diamond) {
score += 1;
guiScore.text = "Score: " + score;
}
else{
Debug.Log("Wrong Answer!");
}

}

function OnMouseUp () {
AcceptInput = true;
GameObject.Find("Shape").GetComponent(ChangeSprite).enabled = false;
}

It changes the sprite too early. When I press the button it would add the score before it even displayed the sprite. Any ideas? Any help would be much appreciated. Thanks

If you are using AcceptInput to ensure that the code in OnMouseDown() is not called repeatedly I suggest using a lock like this:

function OnMouseDown () {
    if(!AcceptInput){
        return;
    }
    AcceptInput = false;
    // ...
}

function OnMouseUp () {
    AcceptInput = true;
    // ...
}