turret rotation audio problem

I made a model of a mech type robot. The problem i have is i want to add a sound file when i rotate it.
The keys for rotation are a = right and d =left.
i have tried following the posts to assign a audio file to this action but having problems.
I add an audio source to the object and then a script to it but it keep getting error problems. Can someone help me out with this? I have tried some scripts i found on the forum but they dont work for me. This is a play on push key action

thanks

wayne

You must add an AudioSource to the object, assign the sound you want to play to the clip property (at the Inspector) and observe the controls: while they are pressed, play the sound - but you must wait the sound end before play it again, or you will get a horrible noise instead:

function Update(){ // check if a OR d pressed
    if (Input.GetButton("a") || Input.GetButton("d")){
        if (!audio.isPlaying){ // if sound ended...
            audio.Play();      // repeat the sound
        }
    }
}