Help with random melee noises?

Previously I recorded five different audio tracks for sounds that the player makes when stabbing. Know i just need help with coding some thing that selects a sound to play at random.

var sound1: AudioClip;

if (Input.GetButtonDown("Fire1"))
// let me select a noise at random

Make a List with all the audio clips in, and then randomly generate an index.

Not sure if my code will work, I’m not used to JS, but it should give you the basic idea. This first part, should be outside the Update()/OnGUI() function you are using.

var sound1: AudioClip;
var sound2: AudioClip;
var sound3: AudioClip;
var sound4: AudioClip;
var sound5: AudioClip;

var sounds = [sound1,sound2,sound3,sound4,sound5]

I think you know where you should place this :

if (Input.GetButtonDown("Fire1")){
    audio.PlayOneShot(sounds[Random.Range(0, sounds.length)]);

EDIT : As Chronos-L pointed out, the max value of Random.Range isn’t included in the interval of random numbers. So I changed it to Random.Range(0, sounds.length).