Play sound on collision

I know many people have asked this question, but mine is different, and i didn’t found anything that would work as i need, so i am going to ask it again.

I have a script that allow the game to play a sound when ANYTHING collides it. I have many houses in my scene with this script and a knock sound and an enemy with an emergency sound attached to one of his body parts. Also, the player has a GPS.

The GPS was supposed to collide ONLY with the ENEMY’s BODY PART, so i need to change some things in my script, but i don’t know what and how, because i am just a beginner at scripting. The enemy’s special body part (he is a robot) is tagged with the tag BIP. I want to make the following only with ONE SCRIPT:

The script needs to recognize the tags. The things such as a DoorSound square tagged as HouseSound don’t play their sounds when the player’s GPS that is also tagged when it collides with it, but the enemy’s special body part that is tagged NEED to play his sound when the GPS collide with it.

Any ideas? Here’s my script: It’s javascript.

var Sound:AudioClip;
var isColl = false;

function OnTriggerEnter (o:Collider) {
    if (isColl == true) {
        GetComponent.<AudioSource>().Play();
    }
}

    function OnTriggerExit (o:Collider) {
        isColl = true;
    }

I know it is complicated, but can anyone help me? I tried everything that i know =(

Why do You need “isColl”? You set if is something colliding in… Function when something collides, and won’t trigger any else. And about the problem: Just get the tag from colliding object and check it?

    void OnTriggerEnter(Collider other)
    {
        //other holds all the info which You need :)
        if ( other.gameObject.CompareTag("Enemy") ) // If other have tag "enemy"
        {
           //Oh, do the stuff for the enemy.
        }
       
    }