Use condition to start

Hi the question is this:

I want to use a condition, like a boolean, to start an animation, and inmediatly it start, change that boolean, but dont stop the animation.

Example:
var canJump : boolean = true;

function Update {
if (canJump)
{
play.Animation(“Jump”);
canJump = false;
yield WaitForSeconds (2);
canJump = true;
}
}

So, in this example, I want to jump, and dont be able to jump again until 2 sec. But if I do this way, inmediatly canJump is turned false, the animation stop.

Any Idea?

Okay, I haven’t worked with UnityScript in a LONG time, but I feel as though this is correct.

var doPlay : boolean;

function Start()
{
	doPlay = true;
}

function Update()
{
	if(doPlay) {
		PlayAnimation();
	}
}

function PlayAnimation()
{
	play.Animation("Jump"); 
	doPlay = false; 
	yield WaitForSeconds(2); 
	doPlay = true;
}