Send message from an instantiated prefab to another

Hey again guys,

I am currently trying to get bullets working.

I have a system that spawns a space ship prefab, this spaceship prefab then moves around on its own and fires a bullet prefab, the bullet prefab use a script to detect collusion with an enemy spaceship prefab, I’m trying to get this bullet to call a function from whatever it hits.

To do this I’m using a sendmessage like this

function OnTriggerEnter( other : collider ) {
if( other.tag == “Player” )
{
var target : GameObject = other.gameObject;
target.SendMessage(“Take_Damage”, 1 );
}

}

However this returns an error message saying there is no receiver and doesnt call the takedamage function.

Why is this? Its definatly hitting the enemy, the method i used before was actually setting a reference to the script of the enemy ship and calling the function by setting the collider object to the reference
However, different ships use different scripts (though they will all have the same Take_Damage function)
So i need something that can just call a function from whatever the script of the object it hits.

Does anyone have any idea of why this isn’t working, or rather a different way to do this?

make sure the gameObject collider your hitting also contains the script your trying to talk to.
if your not sure your taking to the right object try BroadcastMessage or SendMessageUpwards, but if there are multiple scripts that can be the receiver, it is only recived by the first one it finds.

The weird part is
It only works on one of the ships now, even though they both have almost the same script (the only notable difference if one searches for a different tag)