# \[SOLVED\] Error when messaging collection proxied GUI address

**URL:** <https://forum.defold.com/t/solved-error-when-messaging-collection-proxied-gui-address/76280>\
**Category:** Questions\
**Created:** [March 12, 2024, 1:43pm UTC](https://forum.defold.com/t/solved-error-when-messaging-collection-proxied-gui-address/76280 "2024-03-12T13:43:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Garfold](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/garfold/32/35371_2.png) [@Garfold](https://forum.defold.com/u/Garfold)\
**Post date:** [March 12, 2024, 1:43pm UTC](https://forum.defold.com/t/solved-error-when-messaging-collection-proxied-gui-address/76280/1 "2024-03-12T13:43:43Z")

</div>

Hello. I’ve followed the [ColorSlide tutorial](https://github.com/defold/tutorial-colorslide) through to the end and everything works as expected.

I’m now trying to implement the first ‘what next?’ suggestion (updating LEVEL display) by posting the level number from loader.script to collection-proxied level.gui\_script, but get an error:

> ERROR:SCRIPT: main/loader.script:33: Could not send message ‘level\_indicator’ from ‘default:/loader#loader’ to ‘level\_1:/level\_1#gui’.  
> stack traceback:  
> [C]: -1: in function post  
> main/loader.script:33: in function \<main/loader.script:27\>
> 
> DEBUG:SCRIPT: url: [level\_1:/level\_1#gui]

loader.script

```lua
-- << are the lines I've added
function on_message(self, message_id, message, sender) -- line 27
	if message_id == hash("load_level") then
		self.current_level = message.level
		local proxy = "#proxy_level_" .. self.current_level
		local proxygui = "level_1:/level_1#gui" -- << simplified to a string for testing <<
		msg.post(proxy, "load")
		msg.post(proxygui, "level_indicator", { level = self.current_level } ) -- << line 33 <<
	elseif message_id == hash("next_level") then
		...

```

level.gui\_script

```lua
function on_message(self, message_id, message, sender)
	print(msg.url()) -- <<
	if message_id == hash("level_completed") then
		local done = gui.get_node("done")
		gui.animate(done, "position.x", 320, gui.EASING_OUTSINE, 1, 1.5)
	elseif message_id == hash("level_indicator") then -- <<
		local indicator = gui.get_node("level") -- <<
		print("here") -- <<
		gui.set_text(indicator, message.level) -- <<
	end
end

```

collection structures:

 ![level_1](https://forum-defold-uploads.b-cdn.net/original/3X/3/6/36635d7fc68567c51fa695a52eafc49e792bd78b.png)  
 ![main-collection](https://forum-defold-uploads.b-cdn.net/original/3X/f/0/f09b4eccce787e8aa6ad1bc678ba7971ba2b3ac2.png)  
 ![level-go](https://forum-defold-uploads.b-cdn.net/original/3X/9/1/91e124354b9fa284973bfdd8f7616e6ee751e4dd.png)

The DEBUG:SCRIPT: url: [level\_1:/level\_1#gui] after the error is down to level.script (successfully) messaging the same gui\_script at a later, unrelated time:

level.script

```lua
				--check whether the board is solved
				if all_correct(self.bricks) then
					msg.post("#gui", "level_completed")
					self.completed = true
				end

```

I know there are other ways of updating the LEVEL display, but I’d be better getting to grips with the messaging system. “level\_1:/level\_1#gui” ([socket:/path#fragment](https://forum.defold.com/t/message-addresses-with-proxy-collections-solved/64840/4)) seems like it should be right.

Someone else with a similar unresolved problem:

> [@Message Cant Be Sent?](https://forum.defold.com/t/message-cant-be-sent/72940/4):
>
> I have used that in the recieving script and copied and pasted the url into the msg.post for the script i am trying to send from and it still gives the same error unfortunately.

Thanks

---

<div class="post-metadata">

**Author:** ![Chung\_Xa](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/chung_xa/32/34470_2.png) [@Chung\_Xa](https://forum.defold.com/u/Chung_Xa)\
**Post date:** [March 12, 2024, 2:05pm UTC](https://forum.defold.com/t/solved-error-when-messaging-collection-proxied-gui-address/76280/2 "2024-03-12T14:05:14Z")

</div>

My first thought is you should wait for the “proxy\_loaded” message and enable it before sending messages to it

---

<div class="post-metadata">

**Author:** ![Garfold](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/garfold/32/35371_2.png) [@Garfold](https://forum.defold.com/u/Garfold)\
**Post date:** [March 12, 2024, 2:45pm UTC](https://forum.defold.com/t/solved-error-when-messaging-collection-proxied-gui-address/76280/3 "2024-03-12T14:45:54Z")

</div>

Thanks @Chung_Xa , that was exactly it - I thought it might be a timing issue but wasn’t entirely sure.

This worked:

```lua
function on_message(self, message_id, message, sender)
	if message_id == hash("load_level") then
		...
	elseif message_id == hash("next_level") then
		...
	elseif message_id == hash("unload_level") then
		...
	elseif message_id == hash("proxy_loaded") then
		msg.post(sender, "init")
		msg.post(sender, "enable")
		local proxygui = "level_1:/level_1#gui" -- <<
		msg.post(proxygui, "level_indicator", { level = self.current_level } )	-- <<
	end

```

---

<div class="post-metadata">

**Author:** ![mrpenguin](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mrpenguin/32/41383_2.png) [@mrpenguin](https://forum.defold.com/u/mrpenguin)\
**Post date:** [October 29, 2025, 5:06pm UTC](https://forum.defold.com/t/solved-error-when-messaging-collection-proxied-gui-address/76280/4 "2025-10-29T17:06:12Z")

</div>

This was also something I struggled with quite a bit. I read through the documentation on addressing in Defold’s documentation but this answer still wasn’t something I could reason out. I’m pretty sure I understand it looking at the solution but I don’t think I would’ve gotten here on my own. I’m guessing that tricky addressing stuff is something that will come up with some regularity. Are there any tools or code snippets that make figuring out an address like this easier to discover?

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [October 29, 2025, 7:39pm UTC](https://forum.defold.com/t/solved-error-when-messaging-collection-proxied-gui-address/76280/5 "2025-10-29T19:39:39Z")

</div>

> [@mrpenguin](#):
>
> Are there any tools or code snippets that make figuring out an address like this easier to discover?

If you are uncertain of the absolute adress of a game object then add a script component to it and print the url:

```lua
function init(self)
   print("The absolute URL is", msg.url())
end

```

---

<div class="post-metadata">

**Author:** ![mrpenguin](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mrpenguin/32/41383_2.png) [@mrpenguin](https://forum.defold.com/u/mrpenguin)\
**Post date:** [October 29, 2025, 7:58pm UTC](https://forum.defold.com/t/solved-error-when-messaging-collection-proxied-gui-address/76280/6 "2025-10-29T19:58:18Z")

</div>

This is incredibly useful, thank you.
