Destroy on collision

Currently i’ve got a box which registers the score once its been touched but is no longer destroying itself

var scoresound : AudioClip;

function OnTriggerEnter(){

    print("You just got some score!");


I’m quite new to unity but this worked on something else before and no longer works. For some reason the audio does not play anything when touched either. I have a sound selected but it just doesn’t seem to play it.

similar to OnTriggerEnter() there is function called OnCollisionEnter() try this one.

I think the problem is with playing the audio. You should attach audioSource to that box. So select that box you have, go to Component → audio → audioSource. And the reason that the box stops destroying itself is that in Unity, if there is an error with a line of code, usually it shows the error in the console window, then the code will not be read any further until that error is solved (It does not always pause reading the script. If the error is ignorable, it justs continue reading the code). Anyway, I hope this will solve the problem.