# Scene.time.paused does not work

**URL:** https://phaser.discourse.group/t/scene-time-paused-does-not-work/6734
**Category:** Phaser 3
**Created:** [June 21, 2020, 3:20pm UTC](https://phaser.discourse.group/t/scene-time-paused-does-not-work/6734 "2020-06-21T15:20:22Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Felicia\_Debye](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/felicia_debye/32/3220_2.png) [@Felicia\_Debye](https://phaser.discourse.group/u/Felicia_Debye)
#### Post date: [June 21, 2020, 3:20pm UTC](https://phaser.discourse.group/t/scene-time-paused-does-not-work/6734/1 "2020-06-21T15:20:22Z")

</div>

Hi,

i want to add a Clock to my game, which Shows the time you spend for a level.  
But while you answering a question, the timer should be paused.

So i tried like this:

```
update() {
	var timer = this.time.now - 10000;
	timeText.x = this.cameras.main.scrollX + 16;
	timeText.setText("Zeit: " + Phaser.Math.RoundTo(timer/1000, 0) + " Sek.");
	// show minutes after 60 seconds
	if(Phaser.Math.RoundTo(timer/1000 >= 60)) {
		timeText.setText("Zeit: " + Phaser.Math.RoundTo(timer/60000, -2) + " Min.");
	};
	//pause timer while quiz is visible
	if(quiz.visible){
		this.time.paused = true; 
	} else {
		this.time.paused = false;
		}
}

```

The timer works fine but i doesn’t stop counting while quiz is visible whether the bool of this.time.paused is true at this moment.  
What am I doing wrong?

Thanks a lot!

---

<div class="post-metadata">

### Author: ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)
#### Post date: [June 22, 2020, 3:14pm UTC](https://phaser.discourse.group/t/scene-time-paused-does-not-work/6734/2 "2020-06-22T15:14:58Z")

</div>

I would use a timer event for this.

```javascript
var timer = this.time.addEvent({ delay: 999999 });

timer.getElapsedSeconds();
timer.paused = true;

```

---

<div class="post-metadata">

### Author: ![Felicia\_Debye](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/felicia_debye/32/3220_2.png) [@Felicia\_Debye](https://phaser.discourse.group/u/Felicia_Debye)
#### Post date: [June 22, 2020, 9:07pm UTC](https://phaser.discourse.group/t/scene-time-paused-does-not-work/6734/3 "2020-06-22T21:07:15Z")

</div>

Thanks for your advice but I’m still having trouble getting the right value.

So i added in my update-function:

`var timer = this.time.addEvent({ delay: 999999 });`

```
console.log(timer);
console.log("timer.getElapsed(): " + timer.getElapsed(),"timer.getElapsedSeconds(): " + timer.getElapsedSeconds());
console.log("timer.elapsed: " + timer.elapsed);

```

And the result is:  
 ![timer](https://global.discourse-cdn.com/free1/uploads/phaser1/original/2X/1/1ce08ce365ed6158a45303dc625891c4d40c9c54.jpeg)

So why, if the value of my TimerEvent is 183.76 it returns 0 for every request?

---

<div class="post-metadata">

### Author: ![Darko](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/darko/32/3335_2.png) [@Darko](https://phaser.discourse.group/u/Darko)
#### Post date: [June 22, 2020, 10:10pm UTC](https://phaser.discourse.group/t/scene-time-paused-does-not-work/6734/4 "2020-06-22T22:10:31Z")

</div>

Hello, create the timer event in the create function and use it whereever…  
Here it is an example with timer event and pause:

[http://labs.phaser.io/view.html?src=src\time\pause%20and%20resume.js](http://labs.phaser.io/view.html?src=src%5Ctime%5Cpause%20and%20resume.js)

I hope it helps to understand

---

<div class="post-metadata">

### Author: ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)
#### Post date: [June 22, 2020, 11:09pm UTC](https://phaser.discourse.group/t/scene-time-paused-does-not-work/6734/5 "2020-06-22T23:09:54Z")

</div>

Create the timer just once, then read elapsed time in `update()`.

https://codepen.io/samme/embed/preview/VwebvRV?height=300&slug-hash=VwebvRV&default-tabs=js,result&host=https://codepen.io
