to get this script to work just add a flashlight to the player and attach this script to it .... i know really simple but it works fine
Code:
var FlashSound : AudioClip;
var linkedLight : Light;
function Update () {
if(Input.GetKeyDown("f")){
linkedLight.enabled = !linkedLight.enabled;
audio.PlayOneShot(FlashSound, 1.0 / audio.volume);
}
}
function LightOff (){
linkedLight.enabled = false;
audio.PlayOneShot(FlashSound, 1.0 / audio.volume);
}