Infinite loop problem

Hi guys, I am making a health bar system and want to make a soft transition when the character takes damage. I am quite new to Unreal engine and my while loops makes an infinite loop although the condition is ok. I have two health bars that are overlapped. One of them is real health and the other is a shadow version of that health, indicating how much damage is taken at that moment. After one second of delay, I want to decrease the shadow health smoothly. What is wrong with my logic? Thank you!

UE4 does better with asynchronous logic. That means instead of having a loop, you set a timer that calls an event repeatedly. The event has a setting that tells it how often to call the event. In the event, you do one step of the process and then see if it’s time to stop. When it’s time to stop, you cancel the timer.

Check out for more info. After that anything else you need, you should have the info to devise the right web search. If not, feel free to ask more.

AliTeo,

I think your logic is fine, except that you are not setting ShadowHealth = Health before you do Health = Health - 25.

Best,
Alessandro

Thank you for your help guys! After I made some research, came up with this code. It is working now !