// Update is called once per frame void Update() { //each frame ensure the pee position is on the player transform.position = player.transform.position; transform.eulerAngles = new Vector3(camMouseLook.transform.eulerAngles.x, player.transform.eulerAngles.y + 90.0f, 0.0f); vitals.setBladder((100.0f / changeBladderSpeed) * Time.deltaTime); if (vitals.getBladder() >= 100.0f) { //ensures the bladder value is exactly 100.0f | 100% vitals.setBladder(100.0f, true); //destroyScript(); ParticleSystem emitter = GetComponent <ParticleSystem>(); emitter.Stop(); //create a timer before deleting the object timer += 1.0f * Time.deltaTime; if (timer >= 5.0f) { destroyScript(); } } }