You forgot to specify the message_id.
msg.post(receiver, message_id, [message])
So you’re giving ‘self.hp’ as the message_id and not providing any data with the message.
You need to re-read the documentation on how these functions work, you’ve also got some issues in your on_message function. You’re referencing ‘message.other_id’, but that doesn’t exist because you never sent a message with a table with the key: ‘other_id’! Perhaps you meant to use ‘sender’? Then you’re using ‘message.id’ with gui.set_text, which, like ‘message.other_id’, does not exist because you never set it, possibly it’s a typo and you meant to put ‘message_id’? But the ‘message_id’ will always be a hash, not a string, so it won’t work with gui.set_text.
Doc for msg.post: API reference (msg)
Doc for on_message: API reference (go)
[Edit] Sorry, I got a bit sidetracked from the main question there. Probably your URLs are wrong. You’re using the socket “hud”, which I doubt exists.
From the Addressing manual:
"A URL is an object, usually written as specially formatted strings. A generic URL consists of three parts:
[socket:][path][#fragment]
socket
- Identifies the game world of the target. This is important when working with Collection Proxies and is then used to identify the dynamically loaded collection."
If you specify a different socket, it means you’re addressing something in a completely different game world, so unless you’re using Collection Proxies, then you never need it (almost never).
I can’t tell you what the correct URL would be without knowing how your collections are set up. Where is your HUD compared to your Player?