# Set health bar not working in custom event

**URL:** <https://forums.unrealengine.com/t/set-health-bar-not-working-in-custom-event/1240612>\
**Category:** Blueprint\
**Tags:** unreal-engine, Widget, Blueprint, question\
**Created:** [July 26, 2023, 1:07pm UTC](https://forums.unrealengine.com/t/set-health-bar-not-working-in-custom-event/1240612 "2023-07-26T13:07:22Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Evilrunic](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Evilrunic](https://forums.unrealengine.com/u/Evilrunic)\
**Post date:** [July 26, 2023, 1:07pm UTC](https://forums.unrealengine.com/t/set-health-bar-not-working-in-custom-event/1240612/1 "2023-07-26T13:07:22Z")

</div>

This blueprint is not setting widget health bar or number but will set it out side of the function. Does it look like there is anything wrong with it or some box I need to check for passthrough values?

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/e/8/ae833ea8564508715a98a4226e4c2401fa434c20.png)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [July 26, 2023, 1:41pm UTC](https://forums.unrealengine.com/t/set-health-bar-not-working-in-custom-event/1240612/2 "2023-07-26T13:41:43Z")

</div>

Does it print where you say _bug_?

---

<div class="post-metadata">

**Author:** ![Evilrunic](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Evilrunic](https://forums.unrealengine.com/u/Evilrunic)\
**Post date:** [July 26, 2023, 3:09pm UTC](https://forums.unrealengine.com/t/set-health-bar-not-working-in-custom-event/1240612/3 "2023-07-26T15:09:01Z")

</div>

Thanks so much for replying everynone!  
yes I simplified it even more it refuses to set the text  
with both the setText function and the Set of the variable with the target of health num  
could it have something to do with where the text is in the widget?

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/4/2/842a58c2c3ada1e4e6cc330fbdaf6fdc84c95247.png)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [July 26, 2023, 3:28pm UTC](https://forums.unrealengine.com/t/set-health-bar-not-working-in-custom-event/1240612/4 "2023-07-26T15:28:19Z")

</div>

- could you clarify: does it print where you say _bug_? Not sure whether you’re confirming it or not.
- could you also show this bit for the text you’re trying to set:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/7131edca3c3597b3c91b9322b78eaf44b556b12c.png)

- and lastly, could you show / tell how you add this widget to the viewport / screen

* * *

I am grilling you because the script you’re showing seems fine at a glance 😇 There’s a chance we need to look elsewhere for the culprit; merely trying to eliminate the typical scenarios that may cause issues.

---

<div class="post-metadata">

**Author:** ![Evilrunic](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Evilrunic](https://forums.unrealengine.com/u/Evilrunic)\
**Post date:** [July 26, 2023, 3:48pm UTC](https://forums.unrealengine.com/t/set-health-bar-not-working-in-custom-event/1240612/5 "2023-07-26T15:48:06Z")

</div>

Yes bug printed every time with the correct text that I wanted to add but text never changed. The only way I could change text is by setting it when the widget is constructed or on tick. The text bot has no default text and has is variable checked as well as the progress bar but I’m not even thinking about him rn.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/f/7/df734dcd24f0fb1cebad98ef9d0eb82a20398f21.png)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [July 26, 2023, 3:54pm UTC](https://forums.unrealengine.com/t/set-health-bar-not-working-in-custom-event/1240612/6 "2023-07-26T15:54:19Z")

</div>

- could you also show this bit for the text you’re trying to set (What’s in the Bind? Is there anything there?):

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/7131edca3c3597b3c91b9322b78eaf44b556b12c.png)

- how and when is `SetHealthBar` called? You’re not storing a reference to the widget, hard to imagine how it’s called.

- what calls Start Game?

* * *

Potentially irrelevant at this point but, from the design point of view, is there a reason why the Player Controller creates the health bar widget? Isn’t Annie more than capable of handling her own health updates? Do tell, you may be juggling a bunch of characters and have a good reason for doing it in the PC. It just sounds counterproductive.

---

<div class="post-metadata">

**Author:** ![Evilrunic](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Evilrunic](https://forums.unrealengine.com/u/Evilrunic)\
**Post date:** [July 26, 2023, 4:46pm UTC](https://forums.unrealengine.com/t/set-health-bar-not-working-in-custom-event/1240612/7 "2023-07-26T16:46:58Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/4/5/1450108b85a0e58c3a845ec91761a5c7b71713dd.png)  
start game is called by pressing the play button on main menu  
I was under the impression I should have the value health for characters in the PC so that if a player in the game disconnects then it is still stored because PC will not reset until level is changed which will never happen as it is just an arena game no other maps.

---

<div class="post-metadata">

**Author:** ![Evilrunic](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Evilrunic](https://forums.unrealengine.com/u/Evilrunic)\
**Post date:** [July 26, 2023, 4:48pm UTC](https://forums.unrealengine.com/t/set-health-bar-not-working-in-custom-event/1240612/8 "2023-07-26T16:48:54Z")

</div>

oh usually set health bar is connected and works i’ve moved things an dput it back so you can see

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [July 26, 2023, 4:58pm UTC](https://forums.unrealengine.com/t/set-health-bar-not-working-in-custom-event/1240612/9 "2023-07-26T16:58:16Z")

</div>

My best bet atm is that you’re updating the wrong widget. Here you create it:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/4/4/444c5deb9e9ef950749489ae31c944a8c19fc065.png)

It’s not referenced at all, yet you:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/b/8/eb8a24ca04d59a6bcb00016d015850f943f029be.png)

What’s up with that? Where is this var coming from and what is it referencing?

---

<div class="post-metadata">

**Author:** ![Evilrunic](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Evilrunic](https://forums.unrealengine.com/u/Evilrunic)\
**Post date:** [July 26, 2023, 5:05pm UTC](https://forums.unrealengine.com/t/set-health-bar-not-working-in-custom-event/1240612/10 "2023-07-26T17:05:50Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/7/d/c7d6249faefc07b1182bb20a2d9589bd00f73b5b.png)  
its the health bar widget

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [July 26, 2023, 5:23pm UTC](https://forums.unrealengine.com/t/set-health-bar-not-working-in-custom-event/1240612/11 "2023-07-26T17:23:57Z")

</div>

Yeah, but how do you set the value? Creating a variable does nothing without setting the value and you do not set it. Are you not getting any errors?

At some point you said this was printing OK:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/1/c/91cf1bbec35bd20bf920184b82682be9afd0db99.png)

But you’re not accessing this widget at all, judging by this:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/c/4/0c43a5cc12a35f334ec27439fd74ad1a61cc9304.png)

Are you, perhaps, using a widget component? And then create another widget that simply overlaps it?

* * *

Which widget is this variable pointing to:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/b/0/5b038217b7e0e5a233b759a62ed5d871522c265e.png)

Because it’s **not** pointing to this one:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/1/e/31eb47665a30f2d6afb01cb66c3bbec8858975bf.png)

---

<div class="post-metadata">

**Author:** ![Evilrunic](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Evilrunic](https://forums.unrealengine.com/u/Evilrunic)\
**Post date:** [July 26, 2023, 6:27pm UTC](https://forums.unrealengine.com/t/set-health-bar-not-working-in-custom-event/1240612/12 "2023-07-26T18:27:18Z")

</div>

omg man I’m so dumb. This blueprinting is making me forget basic codding update health now works. I was doing just what you said adding text values to a widget that sure wasn’t on the viewport. Can’t wait to clean this spaghetti up, if you would indulge me with this last question, where would you put the stats for health that will be changed periodically when the character level is increased?

Thanks again for all the help you’ve given in this thread

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [August 25, 2023, 6:27pm UTC](https://forums.unrealengine.com/t/set-health-bar-not-working-in-custom-event/1240612/13 "2023-08-25T18:27:55Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
