Having a hard time getting sound to work

I can’t seem to find out what I’m doing wrong despite how many tutorials and forums I look through. It will play the sound if I use the Play on Awake checkbox. I put a debug log before the audio playing and see a message so there’s not a problem with my logic.

using UnityEngine;
using System.Collections;

public class Box : MonoBehaviour {
	public string ID;
	public AudioClip wrongSound;

	private bool Good;
	private AudioSource source;

	// Use this for initialization
	void Awake () {
		source = GetComponent<AudioSource> ();
		Good = false;
		if (ID == "Distractor") {
			Good = true;
		}
	}


	void OnCollisionEnter (Collision col)
	{
		if (col.gameObject.tag == "Red") {
			if (ID == "RedBox") {
				Good = true;
			} else {
				Good = false;
			}
		}

		if (col.gameObject.tag == "Blue") {
			if (ID == "BlueBox") {
				Good = true;
			} else {
				Good = false;
			}
		}

		if (col.gameObject.tag == "Floor") {

			if(Good == false){
				source.PlayOneShot(wrongSound,.5f);

			}

			Destroy (gameObject);
		}
		
		if (col.gameObject.tag == "BeltEnd") {
			if(Good == false){

			}
			Destroy (gameObject);

		}

	}

}

Right after calling PlayOneShot() you destroy the game object that also contains the audio source and so the source gets destroyed along with it, never getting a chance to play the sound.

You need to either wait until the sound has finished playing and only destroy the game object afterwards, instantiate a prefab that contains the audio source and play the sound there (you’ll need to destroy the source after it’s done playing) or use AudioSource.PlayClipAtPoint(), which does that automatically but doesn’t allow you to configure the audio source in the editor.