Destroy On Collision

Hi, i am making a game called KillerSquare Tm I have a enemy AI script where the enemy follows the Char_Controller and i want a script that when a enemy(Square) Touches my Char_Controller make the char_Controller get destroyed. all help would be appreciated.

thanks in advance, orangec0w

oh heres the AI script

using UnityEngine;
using System.Collections;

public class EnemyAI : MonoBehaviour {
public Transform target;
public int moveSpeed;
public int rotationSpeed;

private Transform myTransform;

void Awake(){
    myTransform = transform;
}

// Use this for initialization
void Start () {
    GameObject go = GameObject.FindGameObjectWithTag("Player");

    target = go.transform;

}

// Update is called once per frame
void Update () {
    Debug.DrawLine(target.position, myTransform.position, Color.yellow);

    //Look at target
    myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed * Time.deltaTime);

    //Move toward target
    myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
}

}

You’ll need to add colliders to both your enemy and your player. You can make them triggers unless you want physics. From there you can look at the OnTriggerEnter function and destroy the gameohbject (enemy) if the collision is with the player.

So tag your player with “player” and add a collider to both your player and enemy. Mark both of them as trigger. Add this to your AI script:

void OnTriggerEnter(Collider other) {
    if(other.tag == "player"){
        Destroy(this.gameObject);
    }
}