I have a healthbar that works fine, but I also want to add a second bar that shows the damage you took, like this:

so far, the way I have implemented it is by updating the second bar with a delay, which works fine if you take a lot of damage at once.
But i also want it to account for health being drained slowly, as in keeping the “damage bar” in the same position until the health drain is done.
How can i implement this?
you can just simply set attribute “DrainingDamage” on player humanoid on server, and when client handles UI bar, check if that attribute exists, if it does, dont shrink the red bar.
another way is to have a threshold that tells u if its draining, for example: if damage taken is above 10, then that means shrink immediately, if its below 10, shrink after damage stopped or dead or etc.
1 Like
Just keep track of the last time a player was damaged. Keep the delay after the damage, but check if the last damage was dealt X seconds before the secound bar would adjust. Then on the last damage, the second bar adjusts, because there wasnt an update to the last damage time.