i nee help by for my script

hello i have a leveling up system created

unity say: /Playerlevel.cs(21,13): error CS1525: Unexpected symbol `{’

here my script:


using UnityEngine;
using System.Collections;

public class Playerlevel : MonoBehaviour {

private int curLevel = 1;
private int maxlevel;

private int curExp = 1;
private int maxExp = 100;

void Start ()
{

}

void Update ()
{
if(curExp >= maxExp
{
curExp = 1;
curlevel++;
}
}

void onGUI()
{
GUI.Box(new Rect(20, 50, 40, 20), curExp + " / " + maxExp);
GUI.Box(new Rect(20, 90, 40, 20), "Level: " + curLevel);
}
}

2381305–161996–Playerlevel.cs (460 Bytes)

Please use code tags.

You are missing a ‘)’ in the if statement in void Update().

Replace
if(curExp >= maxExp
with
if(curExp >= maxExp)

thanks

and here comes the next error

Playerlevel.cs(23,21): error CS0103: The name `curlevel’ does not exist in the current context

using UnityEngine;
using System.Collections;

public class Playerlevel : MonoBehaviour {

    private int curLevel = 1;
    private int maxlevel;

    private int curExp = 1;
    private int maxExp = 100;


    void Start ()
    {
   
    }

    void Update ()
    {
        if(curExp >= maxExp)
        {
            curExp = 1;
            curlevel++;
        }
    }

    void onGUI()
    {
         GUI.Box(new Rect(20, 50, 40, 20), curExp + " / " + maxExp);
         GUI.Box(new Rect(20, 90, 40, 20), "Level: " + curLevel);
    }
}

here my new script dosent work :frowning:

Capitalize the “l” in “curlevel++;”. you wrote it as “curLevel” at the top

i need a enemyAI/attack/follow/KI/healthsystem/damageToPlayer/damageToMob script

i cant write scripts

can where write this scripts??? pls???

can help me???

The forums are for when you are stuck on a scripting error. The forums are not for us to write code for you, if you have a script and have an error, someone here will be willing to help you.

1 Like

In the OP onGUI should be OnGUI.

can for me the scripts ???