How to use wait for seconds?!?

Hi im trying to get my script to wait 5 seconds before makes all 4 variables true if the health is set to 0… this is what i’ve written… and it doesn’t work :stuck_out_tongue:

            if (Health == 0) 
	{
		Instantiate (deathParticles, gameObject.transform.position, gameObject.transform.rotation);
		Destroy (gameObject);
		StartCoroutine (Waiting());
	}

	IEnumerator Waiting()
	{
		yield return new WaitForSeconds(5);
		deathScreen.SetActive(true);
		resetButton.SetActive(true);
		menuButton.SetActive(true);
		redTrans.SetActive(true);
	}

You are destroying the gameObject. Therefor your yield will never have a chance to fire. Either move the wait logic to an object that isn’t getting destroyed, or move the Destroy call to the end of your Waiting method.