I need to know how to end my game when my player reaches a certain score here is my code

#pragma strict

var pScore:GUIText;
var eScore:GUIText;

function OnGUI()
{
pScore.text = "Player Score: " + Ball.playerScore;
eScore.text = "Enemy Score: " + Ball.enemyScore;

}

use “States” like Playing, Pause, EndGame, Win, Lose

then a simple If(Ball.enemyScore > myValue) then change the state to the one you need and that’s it, when trying to program think of every step of what would you need to do what you want, read alittle about algorithms, and a introduction to C#, doing that will help you lots