# Enabling Scripts and Message Passing

**URL:** <https://forum.defold.com/t/enabling-scripts-and-message-passing/72968>\
**Category:** Questions\
**Created:** [March 27, 2023, 8:52pm UTC](https://forum.defold.com/t/enabling-scripts-and-message-passing/72968 "2023-03-27T20:52:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adam\_S](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/adam_s/32/31672_2.png) [@Adam\_S](https://forum.defold.com/u/Adam_S)\
**Post date:** [March 27, 2023, 8:52pm UTC](https://forum.defold.com/t/enabling-scripts-and-message-passing/72968/1 "2023-03-27T20:52:41Z")

</div>

I’m trying to load one collection send a message to this collection and have a GUI disable. However, when I insert the message passing to the collection the GUI disable doesn’t work until I do it for a second time.

```lua
	elseif message_id == hash("start_track1") then
		--Loads track collection
		msg.post("#track1_proxy", "load")
		print('track1 collection loaded')
		--stops menu music
		sound.stop("#menuMusic")
		--Send message of car colour to track1 collection
		msg.post("Track1:/Main#Track1", self.carColour)
		print("car colour set")
		--Disables menu GUI
		msg.post("/Object#menu_gui", "disable")
		print('menu.gui script disabled')

```

The message “strack\_track1” is received on a button press and the loading and disabling works when I comment out passing the message to track1 collection. Any help much appreciated.

---

<div class="post-metadata">

**Author:** ![Potota](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/potota/32/33404_2.png) [@Potota](https://forum.defold.com/u/Potota)\
**Post date:** [March 27, 2023, 9:15pm UTC](https://forum.defold.com/t/enabling-scripts-and-message-passing/72968/2 "2023-03-27T21:15:54Z")

</div>

When you send the `load` message to a proxy it takes a bit for the contents to _actually_ load, so you can’t send messages into the new collection immediately. Once a proxy is ready it’ll send a [`proxy_loaded`](https://defold.com/ref/stable/collectionproxy/#proxy_loaded) message back to you, meaning that everything’s ready and you can now send it messages!
