I don’t understand what’s wrong and I am still a bit new to js. I am doing an animation and this error keeps coming up, I can’t find the error hopefully you guys can help. The error is at line 31 and it’s with the swinging animation.
#pragma strict
private var hasAxe : boolean = false;
private var canSwing : boolean = true;
private var isSwinging : boolean = false;
private var controller : CharacterController;
private var playerGUI : PlayerGUI;
var swingTimer : float = 1;
function Start()
{
hasAxe = true;
controller = GameObject.Find("First Person Controller").GetComponent(CharacterController);
playerGUI = GameObject.Find("First Person Controller").GetComponent(PlayerGUI);
}
function Update()
{
//AxeSwinging
if(hasAxe == true && canSwing == true)
{
if(Input.GetMouseButton(0));
{
//ReduceStamina
playerGUI.staminaBarDisplay -= 0.1;
//Swinging Animations
animation.Play("Swing");
animation["Swing"].speed = 2;
isSwinging = true;
canSwing = false;
}
}
if(canSwing == false);
{
swingTimer -= Time.deltaTime;
}
if(swingTimer <= 0)
{
swingTimer = 1;
canSwing = true;
isSwinging = false;
}
}