Raycasting now working on enemy AI (Using A* pathfinding)

Hi guys
So, I’ve made a basic little shooting script, and a basic receiver, and it works just fine. However, when I add it to my AI object (Using A* Pathfinding and the AIPath script), it wont work at all.
Heres my shoot script-

#pragma strict
var AllowFire : boolean = true;

function Start () {

}

function Update () {
if (Input.GetButton("Fire1")){
if (AllowFire == true){
Shoot();
}
}
}


function Shoot(){
AllowFire = false;
var rayhit : RaycastHit;
//var PlayRanger = transform.TransformDirection(Vector3(0,0,10));
var PlayRanger = transform.forward;
if (Physics.Raycast((transform.position + Vector3.up * 0.75),PlayRanger, rayhit)){
rayhit.transform.SendMessage ("HitByGun");
Debug.DrawRay (transform.position, PlayRanger, Color.green);
}
yield WaitForSeconds (0.2);
AllowFire = true;
}

And my receiver

#pragma strict

function Start () {

}

function Update () {

}

function HitByGun(){
Debug.Log ("Hit");
Destroy (gameObject);

}

I have no idea what Im doing wrong here, since it works with non AI objects

Bump?

Try using rayhit.collider.SendMessage

Sadly that didnt work either

Print out the rayhit.transform.name, its correct object?

Add ‘SendMessageOptions.RequireReceiver’ to sendmessage so error comes up if nothing is there…