- Home /
I messed up my script. Anyone wanna help?
So, I am not exactly a pro at Unity scripting. I mean, I am great at placing objects and making them look pretty but scripting isn't exactly my thing. So I tried fixing my script by just throwing brackets and semicolons in places and it ended up making it worse.
I decided to just take a screenshot of my errors to make things easy.
Here is my code. I am trying to make it so I can set the health to 0 with the press of a button.
var Health = 100;
function ApplyDammage (TheDammage : int)
{
Health -= TheDammage;
if(Health <= 0)
{
Dead();
}
}
function Dead()
{
function update() {
if (Input.GetKeyDown("k")) {
Health = 0;
}
}
Thanks in advance for anyone who can help me fix this.
Answer by Dave-Carlile · Aug 06, 2013 at 12:53 PM
function Dead()
{
} // <---- you're missing the closing brace here
I feel silly now.
I did get this error now. What does it mean?
It means there's a variable that you're using that isn't set to a value. It'd probably work best to accept the answer here (by clicking the checkmark by the answer), and start a new question with the new issues so you can show your source code and provide the necessary details.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Why does this do nothing (Health Script) 2 Answers
Health Bar common effect 2 Answers
c#help reversing a script 1 Answer