Help With A Script for Playing a random sound from array

I can’t seem to get around this error

The script i’m trying to use is

var jump: AudioClip[];
function Update () {
    if (Input.GetKeyDown (KeyCode.Space))
    {

        GetComponent.<AudioSource>().PlayOneShot(jump);

        if (GetComponent.<AudioSource>().isPlaying) return; // don't play a new sound while the last hasn't finished
        clip = jump[Random.Range(2,jump.length)];
        GetComponent.<AudioSource>().Play();
    }
}

where pressing space at all will play one sound out of an array.

I couldn’t find much on the subject, if I could get any help to fix this, i would be greatful

Line 6 is essentially trying to pass the whole jump array into PlayOneShot(), which is where the error is coming from. Do you want to play jump[0] or jump[1] at the same time as the randomly selected sound? If so, add the index to the array name in line 6. If not, then I’m not sure what the point of that line is; maybe it isn’t supposed to be there?

Also, on line 9, use GetComponent.<AudioSource>().clip.

I would do something like this to spilt it up:

public int numClips;

    public AudioClip[] audioClip;

    void OnDoSomeThing () {
        int randSound = Random.Range (0, numClips);
        PlaySound (randSound);
    }

    void PlaySound (int clip)

    {
        AudioSource audio = GetComponent<AudioSource> ();
        audio.clip = audioClip[clip];
        audio.PlayOneShot(audio.clip, 0.8f);
    }

alright now it 's bringing a new problem of

I think you missed some of that error message. Also, can you post your new code when you make updates to prevent miscommunications? I don’t know that you changed it exactly in the way that I meant to suggest.

Alright, yeah, i re read and edited the script, the sounds work now, thank you so much for informing me on the index!