My Animation won't stop looping

My animation dont stop looping and is configured in Once wrap mod… This is a script error i think. Anyone can help me?

var wrapMode: WrapMode;

function Start () {
animation["ShootAnim"].wrapMode = WrapMode.Once;
}

function Update () {
if(Input.GetMouseButtonDown(0));
animation.Play("ShootAnim");
}

Try this:

var wrapMode: WrapMode;
 
function Start () {
     animation["ShootAnim"].wrapMode = WrapMode.Once;
}
 
function Update () {
     if(Input.GetMouseButtonDown(0));
           animation.Play("ShootAnim");
     else{
       animation.Stop("ShootAnim");
    }
}

try opening and closing the if package “{ }” before the else begins. Replace the ; after the if with a {.

function Update () {
    if(Input.GetMouseButtonDown(0)){
    animation.Play("ShootAnim");
    }
    else{
    animation.Stop("ShootAnim");
    }
    }

Done o.O :smiley:

var wrapMode: WrapMode;
 
function Start () {
     animation["ShootAnim"].wrapMode = WrapMode.Once;
}
 
function Update () {
    if(Input.GetMouseButtonDown(0)){
    animation.Play("ShootAnim");
	}
	if(Input.GetMouseButtonUp(0)){
	animation.Stop("ShootAnim");
	}
    }