How to make sound play once until called again

So, If my player jumps and lands, I want to make a thump noise like youn would if you landed on the ground. The problem I’m having is that I can’t get it to only play once, and that is when you hit the ground. This is the script so far.

#pragma strict

var isGrounded : boolean = true;
var sounds: AudioClip[];

function Update () {

    var controller : CharacterController = GetComponent(CharacterController);

    if (controller.isGrounded)


        isGrounded = true;
        if (audio.isPlaying) return;
    	audio.clip = sounds[Random.Range(0,sounds.length)];

    	isGrounded = false;


I know the problem with this but I just don’t know how to fix it. I can’t just time the sound because if a player jumps of a hill I want it to make the sound when he lands not in mid air.

Have a look at AudioSource.PlayOneShot. Also make sure your audio only plays if it is not already playing, by using AudioSource.isPlaying.

    audio.PlayOneShot(AudioClip clip, float volume);