Having some problems with a health bar script

Well every time i go to play this pops up

Assets/scripts/PlayerHealth.cs(19,20): error CS8025: Parsing error

so i dont really understand its my 2nd week using
unity

this is my script

using UnityEngine;
using System.Collections;

public class PlayerHealth : MonoBehaviour {
public int maxHealth = 100;
public int curHealth = 100;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {

}

void OnGui {
GUI.Box(new Rect(10,10, Screeen.width / 2 / maxHealth / curHealth)), curHealth + “/” + maxHealth);

}

}

also it say the problem is at line 19

alright i fixed one problem know heres another

Assets/scripts/PlayerHealth.cs(21,84): error CS1002: Expecting `;’

new script
using UnityEngine;
using System.Collections;

public class PlayerHealth : MonoBehaviour {
public int maxHealth = 100;
public int curHealth = 100;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {

}

void OnGui () {
GUI.Box(new Rect(10,10, Screeen.width / 2 / maxHealth / curHealth)), curHealth + “/” + maxHealth);

}

at line 21

Rect(10,10, Screeen.width / 2 / maxHealth / curHealth)

Rect needs four values but you gave it only three.

10
10
Screeen.width / 2 / maxHealth / curHealth

so i need to put four 10s

Might want to fix typos like Screen.width

nope its still not working

You probably need to just replace that with

GUI.Box(new Rect(10,10, Screeen.width / 2 , maxHealth / curHealth), curHealth + “/” + maxHealth);

Assuming you wanted the box to be as wide as maxhealth/curhealth. You also had an extra closing parenthesis there.

well now theres no errors but wheres the health bar at lol

That’s up to you to position/scale. If your division doesn’t return a number greater than zero you won’t be able to see anything.

yeah, he was close that gui 1 time, and the ract 2 time, it mean, he open it two time, and close it three time …

ok so i have to go back to my script and adjust it?

where in the script do I put the positions.

oh and thanks for helping.

? sorry i quite dont understand

links broken

The “l” in “html” got caught outside the URL tag :stuck_out_tongue:

It’s fixed now.

thanks very much