';' expected. Add semicolon at the end.

Where is a semicolon needed in this code?

if(currenthealth <= 0) {
	dead=true;
}

if(dead) {
	AI=(AI)Component.GetComponent("AI");
}

if(ai) { 
	ai.dead=true;
	currenthealth = 0;
}

I don’t see the problem. Usually it would be enclosing of functions if it wasn’t a semicolon.

ai is not a recognized type. If you’re trying to type cast and your script name is “AI”, then you should use the same case for casting.

You should also define AI for clarity, if AI is a type you can use the generic GetComponent for UnityScript so you don’t have to worry about type casting.

var DamageAmount : int = 5;
var TargetDistance : float;
var AllowedRange : float = 15;
var currenthealth : int = 100;

function Update () 
{ 
	if(Input.GetButton("Fire1")) 
	{
		var Shot : RaycastHit;
		var ai : AI;

		if(Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward), Shot)) 
		{
			TargetDistance = Shot.distance;
			
			if(TargetDistance < AllowedRange) {
				Shot.transform.SendMessage("LoseHealth", 2);
			}
		}

		if(currenthealth <= 0) 
		{
			dead=true;
		}

		if(dead) 
		{	
			ai= GetComponent.<AI>();
		}

		if(ai) 
		{ 
			ai.dead=true;
			currenthealth = 0;
		}
	}
}