Sound on collision

I've looked up tons of scirpts for this but none of them really helped or made sence. Just simply trying to make a sound play when you hit an item

the i tried:

function OnTriggerEnter(  otherObject: Collider        ){

    if(otherObject.gameObject.tag == "Player"){
    audio.clip = otherClip;
    audio.Play();
    }
}

It works, but the problem is when i try to put Destroy(gameObject) anywhere in the script it either doesn't destroy but plays sound, or vice versa. What should i do. Thanks :D

You can use AudioSource.PlayClipAtPoint()

This will play the sound without it being attached to a specific AudioSource component on a GameObject, so it won't stop playing when the GameObject is destroyed.