var source : AudioSource; // make an audio source component and put it on your camera.
var clip : AudioClip; // put the sound you want it to make here.
function Start () {
flashlight = GetComponent("Light");
}
function Update () {
if (Input.GetKeyDown (KeyCode.F)) {
if (flashlight.enabled) {
flashlight.enabled = false;
// put the sound code shown later here if you want it to make a sound when turning off.
}
else {
flashlight.enabled = true;
source.PlayOneShot(clip) // this will play the sound file "clip" through the "source".
}
}
}