# How would I get a data variable from a go object into a gui object

**URL:** <https://forum.defold.com/t/how-would-i-get-a-data-variable-from-a-go-object-into-a-gui-object/77153>\
**Category:** Questions\
**Created:** [June 7, 2024, 3:00pm UTC](https://forum.defold.com/t/how-would-i-get-a-data-variable-from-a-go-object-into-a-gui-object/77153 "2024-06-07T15:00:08Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Stale](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/stale/32/32618_2.png) [@Stale](https://forum.defold.com/u/Stale)\
**Post date:** [June 7, 2024, 3:00pm UTC](https://forum.defold.com/t/how-would-i-get-a-data-variable-from-a-go-object-into-a-gui-object/77153/1 "2024-06-07T15:00:08Z")

</div>

I’m trying to create two health bar for two player characters which use the same collection, the hp value is stored inside the collection, as well as each individual ID

The issue is that for me to scale the hp bar, I am going to need the values of the hp and id in the gui object, however I have not found a way to do this

both these values are stored as self. values due the characters using the same code

I’ve tried using global functions and msg.post. But I can’t access self with the former and can’t return a value with the later.

Any ideas

---

_[View the full topic](https://forum.defold.com/t/how-would-i-get-a-data-variable-from-a-go-object-into-a-gui-object/77153)._
