How to load next level?

I have this code here:

function Update () {
         if(Input.GetKeyDown=="space")
            Application.LoadLevel("lvl2");
}

How can i load to the scene “lvl2”? I attached this script to the First Person Controller.

By pressing space. Make sure you actually have a scene called lvl2 added to the build.

As Bérenger said make sure to have the level “lvl2” added in the build settings.

Normally you would detect input like this and not like you did:

function Update () {
    if(Input.GetKeyDown("space"))
        Application.LoadLevel("lvl2");
}

Give this a try and see if that fixes anything.