If this script is on the enemy, you are destroying the enemy before you are finishing your code. Once you destroy it, it can no longer execute the code. Also, you are calling function OnGUI, but OnGUI is always called anyway.
In the future, please try not to ask "whats wrong with my script" but instead, tell us what you intend to do(as you did) and tell is what it is actually doing.
Let me know if that worked for you.
answered Jun 17 '11 at 11:32 AM
sorry forgot to mention this is a math game so when the cube/enemy takes 100 damage a GUI pops up with a multiple choice math question...and if you answer right the enemy gets destroyed and replaced with a dead replacement like a ragdoll:) ....and if you answer wrong nothing happens yet..everything works but i cant get the cube to show the question only when it takes 100 damadge:(
answered Jun 17 '11 at 11:33 AM