void Update() { PlayerVariables playerVariables = GetComponent <PlayerVariables>(); timeLeft -= Time.deltaTime; timeLeftUI.gameObject.GetComponent <Text>().text = ("" + (int)timeLeft); playerScoreUI.gameObject.GetComponent <Text>().text = ("" + playerScore); if (timeLeft < 0.1f) { playerVariables.Respawn(); timeLeft = 180; playerScore = 0; } }