#pragma strict
var playerDistance : int;
var player : GameObject;
var attacking : boolean;
var TakeDammage : boolean;
function Start ()
{
player = GameObject.Find(“Player”);
attacking = false;
}
function Update ()
{
playerDistance = Vector3.Distance(player.transform.position, transform.position);
if(playerDistance <=2)
{
if(!attacking)
{
Invoke(“ApplyDammage”, 3);
attacking = true;
}
}
}
function ApplyDammage()
{
player.SendMessage(“SubtractHealth”);
attacking = false;
}
function OnTriggerEnter(other : Collider){
if(other.tag == “Player”){
TakeDammage = true;
}
}
function OnTriggerExit(other : Collider){
if(other.tag == “Player”){
TakeDammage = false;
}
}
this is my script but it doesnt apply damage to the player, how do i fix it, need help asap