OK so i tried making a zombie health script also for it to get damage from a projectile (NOT RAYCAST) but even though it doesn’t show any arrows for some reason when i try to shoot the zombie it doesn’t work. Hers the script if anyone could halp me out thanks a lot!!!
The Script:
var health : int = 100;
var bullet : GameObject;
var damage : int;
function Update ()
{
if(health < 0)
{
Die();
}
}
function OnTriggerEnter ( hit : Collider )
{
Debug.Log("trigger");
if(hit.gameObject.tag == "zombie")
{
bullet = hit.gameObject;
TakeDamage();
}
if(hit.gameObject.tag == "zombie")
{
bullet = hit.gameObject;
TakeDamage();
}
}
function TakeDamage()
{
health -= damage;
}
function Die()
{
Network.Destroy(gameObject);
}