Pick-up sound script?

I’ve been looking for a pick-up sound script for a while now and I’ve come across this one:

 var collectSound:AudioClip;

function OnTriggerEnter (other:Collider) {
  if(other.gameObject.tag=="Player"){
     AudioSource.PlayClipAtPoint(collectSound, transform.position);
  }
}

I have a ball that rolls around a maze which is tagged “Player” and I already have a pick-up system in place I just need the sound added. When I add this to my pick-up objects nothing seems to happen? I put the desried sound effect in the variable but it still makes no sound?

Any have any idea why it does nothing? xD

Have you set the collider to a trigger ?

yes, the pick-up object is a trigger.

I figured out the problem. My audio listener wasn’t within range so I couldnt hear the sound effect play.

oh alright lol

To that effect, remove the listener from the camera, and attach it to the ball. That would do perfect. ;D