how can i destroy a cube when i press a gui button???

plsplsplspls helpme im stuck!!!..ok im trying to make a script that when the enemy( a cube)with the tag of “enemy” is shoot and is about to be destroyed a GUI button pops up and asks you a question and if you answer wrong the cube doesnt die but if you answer right the cube destroys … i alredy got a character damage script on the cube so when the cube takes 100 damege it gets destroyed…i was thinking to make a script that when a GUI button is pressed it activates another script that destroyes the cube …like this but this is for distance…i want when about to be destroed

link text

if theres no alternative i could use this script so when near the cube the GUI pops up…but pls help me on a destroy “enemy” script…plsplsplsspl

you could just use the Destoy() command?
I guess you have a ‘if’ statement for the GUI.Button,- you could just take the box as a ‘Var : GameObject’ and then set the ‘if’ statement to destroy it if the right button is pressed:

 `if(GUI.Button("Rect stuff here"))
  {
   //The cube is a varible
   Destroy(cube);
  }`

If you need something more flexible, then you can create Functions:

 `function DestroyObject(object:GameObject)
  {
     //the '5' is how long you want to delay the Destroy command
     //(it only works for the destroy command)
     Destroy(object,5);
  }
  //now declare that in the 'if' statement
  if(GUI.Button("rectangle stuff here"))
  {
     //again, cube is a varible defined elsewhere 
     DestroyObject(Cube);
  }`