Turn light on/off

i have spot light n my gun and i want it turn on and off with the same button

so if i press maybe fire1 the light goes on and if i press the button again it should go off

how can i writ in javascript that the light is destroyed and respawn with the same button

like public var Lightpoint : GameObject;

if(Input.GetButtonDown("Fire1")) transform.position = Lightpoint.transform.position;

and now

if(Input.GetButtonDown("Fire1"))

destroy.Gameobject..........

how can i make it???

You can toggle any bool by setting it to the opposite of its current value:

myBool = !myBool;

So you can toggle a light source by toggling its enabled state:

myLight.enabled = !myLight.enabled;

Now you want to do that if you press a certain button:

Light myLight = lightPoint.GetComponent("Light");

if (Input.GetButtonDown("Fire1")) {
    myLight.enabled = !myLight.enabled;
}

I just put this and it worked fine.

Under update put

if(Input.GetButtonDown("Flashlight")){
	light.enabled = !light.enabled;
}

“Flashlight” being whatever key you want to have pressed.
Quick and easy.

there is a problem it say

error UVE001 expected.Insert a semicolon at the end

there in this sentence but there is a semicolon at the end

Light myLight = lightPoint.GetComponent("Light");

here is the java script to turn on/off a light put the script on the light source

private var on = false;
function Update(){
if(Input.GetButtonDown("fire 1")){
if(on){
light.intensity =0;
on = false;
}
else {
light.intensity =2;
on = true;
}
}
}

Unity Tutorial with Multiple Lights