Hi! How would I fix my script so that when the character jumps (with spacebar) I can have a sound play? I think I have got my script pretty close to being finished, but I can’t insert a sound for it to play. Have a look at my script and see if you notice anything.
var AudioNoise : AudioClip;
var keypressed = false;
function Update ()
{
if (keypressed == false && Input.GetKeyDown(“space”)){
keypressed = true;
audio.PlayOneShot(AudioNoise);
}
if (keypressed == true){
StartCoroutine(“ReturnKeyToFalse”);
}
}
function ReturnKeyToFalse(){
yeild WaitForSeconds(3);
keypressed = false;
}