// Update is called once per frame void Update() { //if player is destroyed. if (Player1.GetComponent <StatsManager>().health <= 0) //Player 1 Health = 0 { CalculateVars(); //add code that gets all the other variables from stats, calculates vars in this, and displays in text. SetVars(); //enable end screen EndScreen.SetActive(true); someScript.playerWin.text = "Player 2 Wins!"; //Destroy(gameObject); //keeps you from getting a null reference exception someScript.StopGame(); //calls the stop game function in the timer Restart.isPaused = true; //set game to pause, so everything is paused. but not game menu tho. } else if (Player2.GetComponent <StatsManager>().health <= 0) //Player 2 Health = 0 { CalculateVars(); //add code that gets all the other variables from stats, calculates vars in this, and displays in text. SetVars(); //enable end screen EndScreen.SetActive(true); someScript.playerWin.text = "Player 1 Wins!"; someScript.StopGame(); Restart.isPaused = true; } }