Hello Unity =) Pls Look At this Script

Hello Im creating a main menu for my platform jump game ive created 2 3d text Play and help ive got Scenes for this two but how i make that when i click Play it openes the Scene that game starts and when i click help it starts the help Scene thank you ive made this script but it give me parsing error etc. Errors i think its a failure script ;( pls edit this to a right one thank you =)

using UnityEngine;
using System.Collections;

public class MainMenuScript : MonoBehaviour {

void Awake()
{       
    //Make this script persistent(Not destroy when loading a new level)
    DontDestroyOnLoad(this);

    Time.timeScale = 1.0f; //In case some game does not UN-pause..
}

void OnGUI () {    

    //Detect if we're in the main menu scene
    if (Application.loadedLevel == 0)
    {
        MainMenuGUI();
    }
    else
    {
        //Game scene
        InGameGUI();
    }	
}

void StartGame(int nr)
{
    Application.LoadLevel(nr);
}

void InGameGUI()
{
    //Top-right
    GUILayout.BeginArea(new Rect(0, 0, Screen.width, 50));
    GUILayout.BeginHorizontal();
    GUILayout.FlexibleSpace();
    if (GUILayout.Button("Back to menu"))
    {
        Destroy(gameObject); //Otherwise we'd have two of these..
        Application.LoadLevel(0);
    }
    GUILayout.EndHorizontal();
    GUILayout.EndArea();
}

public GUIStyle invisibleButton;

void MainMenuGUI()
{
    int leftPix = (Screen.width - 600) / 2;
    int topPix = (Screen.height - 450) / 2;
		
	if (Clicked) Button ''Play''}
    {
        StartGame(2);
    }

    }

    GUI.color = Color.black;

    GUILayout.BeginArea(new Rect(Screen.width/2-150, Screen.height/2-100, 300, 200));
    GUILayout.BeginHorizontal();
    GUILayout.FlexibleSpace();

    GUILayout.BeginVertical();
    GUILayout.FlexibleSpace();

    GUILayout.Label("Select a game!");
   
    GUILayout.FlexibleSpace();
    GUILayout.EndVertical();

    GUILayout.FlexibleSpace();
    GUILayout.EndHorizontal();
    GUILayout.EndArea();

}

}

if you’re receiving errors, post them here alongside the script. be sure to include the complete error message (including line numbers). it’s surprising how useful they are…

looks like your cut & paste failed around line 50 - it’s nonsense :frowning:

you probably meant something like

if (GUILayout.Button("Play"))
{
    StartGame(2);
}

also, it’s probably not a great idea to have a function to load levels (StartGame()) and then separately (on line 37) do this:

Application.LoadLevel(0);

you created a function to handle that, why not use it? it’s good practice to keep things like that together so you only need to change/fix/break(!) things in one place :wink:

that said, StartGame() is not a great name if it does things other than start the game!

ps try to fix your code tags so that they include all of the code…