Script error (524841)

#pragma strict

private var guiHealth : GameObject;
private var healthBarScript: HealthBarScript;
function Start() {

guiHealth = GameObject.Find(“GUI Health”);
healthBarScript = guiHealth.GetComponent(“HealthBarScript”);
healthBarScript.healthWidth = 199;
}

function Update() {

reduceHealth();

}
function reduceHealth() {
if(healthBarScript.healthWidth > -8; {
healthBarScript.healthWidth = healthBarScript.healthWidth - 1;
}
}

Unity tells me: Assets/playerhealth.js(18,38): BCE0044: expecting ), found ‘;’.
I can’t seem to find the problem. I am a little new to unity scripting. I appreciate any help.

I assume you cut/pasted the script from somewhere on the web? It looks like text has gone through some web-safe encoding as the line in question is messed up.

The “>” should be a “>”, but I’m not sure about the “-8”. I’d guess it should read like:

if (healthBarScript.healthWidth > -8) {
   healthBarScript.healthWidth = healthBarScript.healthWidth - 1;
}

That should be syntactically correct, but I’m unsure of the “-8” value. That could be some more mangled text. You’d better compare it to the original source where you got it…

Jeff

Thanks.