# Timing

**URL:** <https://phaser.discourse.group/t/timing/14082>\
**Category:** Phaser 3\
**Created:** [March 6, 2024, 12:24am UTC](https://phaser.discourse.group/t/timing/14082 "2024-03-06T00:24:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vegancatter](https://avatars.discourse-cdn.com/v4/letter/v/d6d6ee/32.png) [@vegancatter](https://phaser.discourse.group/u/vegancatter)\
**Post date:** [March 6, 2024, 12:24am UTC](https://phaser.discourse.group/t/timing/14082/1 "2024-03-06T00:24:42Z")

</div>

How do I run a function after a certain amount of time has passed?  
_please don’t send an example please provide code_  
thanks,

---

<div class="post-metadata">

**Author:** ![pyf](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/pyf/32/7754_2.png) [@pyf](https://phaser.discourse.group/u/pyf)\
**Post date:** [March 6, 2024, 5:38am UTC](https://phaser.discourse.group/t/timing/14082/2 "2024-03-06T05:38:19Z")

</div>

```
var timedEvent = this.time.addEvent({
        delay: gameOptions.changeTime,
        callback: this.changeSpeed,
        callbackScope: this,
        loop: true,
    });

```

---

<div class="post-metadata">

**Author:** ![vegancatter](https://avatars.discourse-cdn.com/v4/letter/v/d6d6ee/32.png) [@vegancatter](https://phaser.discourse.group/u/vegancatter)\
**Post date:** [March 6, 2024, 3:14pm UTC](https://phaser.discourse.group/t/timing/14082/3 "2024-03-06T15:14:40Z")

</div>

How will this fire a function? also where would I put this bit of code `create()` or `update()`

---

<div class="post-metadata">

**Author:** ![pyf](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/pyf/32/7754_2.png) [@pyf](https://phaser.discourse.group/u/pyf)\
**Post date:** [March 7, 2024, 1:34am UTC](https://phaser.discourse.group/t/timing/14082/4 "2024-03-07T01:34:07Z")

</div>

var timedEvent = this.time.addEvent({  
delay: “you time”,  
callback: "your function”,  
callbackScope: this,  
loop: true,  
});

put it to create()
