I have a melee script but I don’t know how to make it do damage to either an ai or a player here is the script so far it is in js.
var target : Transform;
function Update ()
{
var dist : float = Vector3.Distance(transform.position, target.position);
if(Input.GetKeyUp(KeyCode.Mouse0) && dist <= 2.1){
GetComponent.<Animation>().Play("Default Take");
}
if(Input.GetKeyUp(KeyCode.Mouse0) && dist > 2.1){
GetComponent.<Animation>().Play("Default Take");
}
}