how to end your game

hey guys i want to end my game if i push in a button(game object), all i want is that when the button(game object) is pushed, that the game closes.

what i have is:

function start
{
    if (input.getkeydown("j"));
    application.quit;
}

but it doesnt work, what am i doing wrong??

A number of things are wrong:

  1. There is no built-function called “start”.

  2. The “Start” function only runs once anyway.

  3. There is nothing called “application.quit”.

  4. If statements do not have semicolons after them. Semicolons are for ending a statement.

4b) Formatting code correctly will help you see errors like that…the Application.Quit() line should at least be indented, and preferably enclosed in braces, though that’s optional with single lines.