Play One time sound on press key

Hi, I get script to Play sound on press key, but this play sound each time i press key and i want play only one time the sound. here is the script :

var audio01 : AudioClip;
function Update () {
if (Input.GetKeyDown ("e"))
{
audio.PlayOneShot(audio01);
 
}
}

how i do that? , btw sorry for my bad english ;_; .

Your English is great. Be sure to tick any useful answer.

It is the round symbol with a tick in the middle. It’s on the left of the answers.

Not the thumb … the Tick. (Checkmark, yes symbol.)

Try it like this.

var iHaveAlreadyPlayedTheSound:boolean;
var audio01 : AudioClip;
function Update ()
    {
    if (Input.GetKeyDown ("e")) maybePlaySound();
    }

function maybePlaySound()
    {
    Debug.Log("someone pressed a key.");
    if ( iHaveAlreadyPlayedTheSound:boolean ) return;
    audio.PlayOneShot(audio01);
    iHaveAlreadyPlayedTheSound:boolean = true;
    }

Hope it helps.