When Gui Text Clicked, Quit Game

Hey guys, i need help on making a gui text a quit button. i already made a font and a text, so i just need help making a quit button. thanks!

the code for the button should look something like

function OnGUI(){
    if(GUI.Button(Rect(0, 0, 200, 50), text)){
        Application.Quit();
    }
}

You will need to use GUIStyle to use your custom font. To quit the game, you can use Application.Quit(). To create a button, look at the reference to GUI.Button.

Here are some code examples:

C#:

using UnityEngine;
using System.Collections;

public class QuitButton : MonoBehavior{
    public Font font;

    private GUIStyle guiStyle;

    void Start(){
        guiStyle.font = font;
    }

    void OnGUI(){
        if(GUI.Button(new Rect(10, 10, 100, 60), "Quit Game", guiStyle)){
            Application.Quit();
        }
    }
}

Unity-JavaScript:

var font : Font;

private var guiStyle : GUIStyle;

function Start(){
    guiStyle.font = font;
}

function OnGUI(){
    if(GUI.Button(Rect(10, 10, 100, 60), "Quit Game", guiStyle)){
        Application.Quit();
    }
}