Little help with my script

Hi there I running into a problem with my script. So I’m having it where these objects I have with the name alien have it when they run into this wall they will destroy but for some reason they go to it but do not destroy. I have the right tags up. Here is the code for the wall I have

function Update(){

}

function OnCollision(collider: Collision){
if (collider.gameObject.tag == “alien”){
Destroy(gameObject);
}
}

and here is the code for the objects as alien that go to the wall

var target : Transform;
var moveSpeed = 3;
var rotationSpeed = 3;
var myTransform : Transform;

function Awake()
{
myTransform = transform;
}

function Start () {
target = GameObject.FindWithTag(“robot”).transform;
}

function Update () {
transform.LookAt(Vector3(target.position.x, transform.position.y, target.position.z));

myTransform.Translate(Vector3.forward * moveSpeed * Time.deltaTime);
}

now I have it where the wall has robot and the alien have the tag alien on it. I will also say I tried using a ontrigger as well and trying a code on the aliens if they hit it they destroy. Anyone have any suggestions. I make it where its real simple just a square going to another cube.

I appreciate that but that is cs sharp. I’m using javascript at the moment. Plus there are some extra codes I don’t need.

The language doesn’t matter, just put the code inside [ code][/code].

By the way:
To receive collision/trigger events a GameObject needs a Rigidbody. If you aren’t using Physics just check the “Is Kinematic” checkbox.

If you want something to occur on collision, you should use OnCollisionEnter(), there is no OnCollision().

Edit: If you want others to look through your code, you should use the code tags as a common courtesy, no one wants to try understanding unformatted code.

Definitely. I didn’t read his code.

you know what, I just see I didn’t have the rigid body on with the kinematic on so let me see if that why it wasn’t working. I really appreciate all this help.

also sorry about that, I never posted in the forums before so my mistake. terrible sorry about that.

What @flonch said is true, check it out.

Going to lecture about common courtesy, then when giving a correction, don’t assume anyone else knows it or knows how. Thats an awesome idea, having seen others use that, would like to, but I have no idea how, and I guess I could start searching, but the problem is I"m ALREADY searching for an answer for other things, and thats not working out so well.

Wow, came off way angrier then I meant it. >_<

But the concept remains, if your going to be condescending about it, at least have the good grace to tell how to do whatever it is you so feel is required.

[-c-o-d-e-] [-/-c-o-d-e-] (take out the “-”'s)

One sentence is a lecture? I was just reinforcing what @ung was saying, since wolfer seemed to be coming up with reasons to not use code tags at the time of my post.
Also look at post #2 and #4, I thought wolfer read those so why would I bother explaining it myself?

YES, TOTALLY A LECTURE!

No, not really, like I suspected then, I had no business posting a hello at that moment, let alone anything else. Everything I was typing was coming off angry.

So, in conclusion, my apologies. =p