# How to properly implement "set\_time\_step"?

**URL:** <https://forum.defold.com/t/how-to-properly-implement-set-time-step/74876>\
**Category:** Questions\
**Created:** [November 7, 2023, 7:51pm UTC](https://forum.defold.com/t/how-to-properly-implement-set-time-step/74876 "2023-11-07T19:51:04Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Regven](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/regven/32/32919_2.png) [@Regven](https://forum.defold.com/u/Regven)\
**Post date:** [November 7, 2023, 7:51pm UTC](https://forum.defold.com/t/how-to-properly-implement-set-time-step/74876/1 "2023-11-07T19:51:04Z")

</div>

```lua
(GUI object)
{...}
			msg.post(":/main#main", "set_time_step", {factor = 0, mode = 1})
{...}

```

If I understood correctly, instead of proxy it is required to insert the root script of the collection, in this case it is main, inside of which there is a go with the name main. Can you please explain what I am doing wrong? Believing the guide and example from britzl ([publicexamples/examples/pause\_game/pause\_game/pause.gui\_script at master · britzl/publicexamples · GitHub](https://github.com/britzl/publicexamples/blob/master/examples/pause_game/pause_game/pause.gui_script)) I have to stop the game, but nothing happens.

Struct:

 ![image](https://forum-defold-uploads.b-cdn.net/original/3X/f/6/f68aa9ff9b27cc9c4c97cb29e6a4d348118b1131.png)

---

<div class="post-metadata">

**Author:** ![benjames171](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/benjames171/32/34759_2.png) [@benjames171](https://forum.defold.com/u/benjames171)\
**Post date:** [November 7, 2023, 10:43pm UTC](https://forum.defold.com/t/how-to-properly-implement-set-time-step/74876/2 "2023-11-07T22:43:39Z")

</div>

Assuming your main collection is called “main” try this to pause:

`msg.post("main:/main", "set_time_step", {factor = 0, mode = 0})`

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [November 7, 2023, 11:40pm UTC](https://forum.defold.com/t/how-to-properly-implement-set-time-step/74876/3 "2023-11-07T23:40:39Z")

</div>

You can only send that event to the collection proxy component.

---

<div class="post-metadata">

**Author:** ![BenBB](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/benbb/32/33861_2.png) [@BenBB](https://forum.defold.com/u/BenBB)\
**Post date:** [November 7, 2023, 11:41pm UTC](https://forum.defold.com/t/how-to-properly-implement-set-time-step/74876/4 "2023-11-07T23:41:47Z")

</div>

> [@Mathias\_Westerdahl](#):
>
> You can only send that event to the collection proxy component.

Then how do you change the time step for the current collection?

---

<div class="post-metadata">

**Author:** ![Regven](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/regven/32/32919_2.png) [@Regven](https://forum.defold.com/u/Regven)\
**Post date:** [November 8, 2023, 4:09am UTC](https://forum.defold.com/t/how-to-properly-implement-set-time-step/74876/6 "2023-11-08T04:09:08Z")

</div>

But how do you send it? I am a relative newbie to programming I have a slight misunderstanding of proxy and how it works. Can you tell me where to send this message or how to find the sending address ?

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [November 8, 2023, 7:41am UTC](https://forum.defold.com/t/how-to-properly-implement-set-time-step/74876/7 "2023-11-08T07:41:46Z")

</div>

You can only change the “current” collection, if it is in fact loaded by a collection proxy.  
Documentation: [Collection proxy manual](https://defold.com/manuals/collection-proxy/#time-step)

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [November 8, 2023, 7:43am UTC](https://forum.defold.com/t/how-to-properly-implement-set-time-step/74876/8 "2023-11-08T07:43:58Z")

</div>

You should see the url of the collection proxy in the editor.  
A common way to debug the url of a game object, is to add a script to it, and in that script, in the `init()` function, add a debug print:

```lua
function init(self):
    print("URL", msg.url()) -- the url to this script
end

```

Knowing that url, you can figure out how to construct your other url.

---

<div class="post-metadata">

**Author:** ![Regven](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/regven/32/32919_2.png) [@Regven](https://forum.defold.com/u/Regven)\
**Post date:** [November 10, 2023, 5:48am UTC](https://forum.defold.com/t/how-to-properly-implement-set-time-step/74876/9 "2023-11-10T05:48:43Z")

</div>

Thank you so much for your tips and explanations. (I did it !)
