Help me with health gui with stackable bars (aka health bar with life)

my mind came up with an idea of making an advanced health gui, and i ended up deciding to make an old school beat-em-up-arcade-style one. in case you dont know what it is, its a gui object which features stackable bars in one container. and how it works? the container consists of bars with color patterns, which indicate an entity’s life points (not the kind of life that exists in mario game). when the top bar drains to zero, life points will drop by one and repeat. not to mention that container can be scaled by how much max health entity has. here’s an example:

when i didnt know how to make it, i went to devforum to search up a useful thread, but found only one, and yet its solution/advice was pretty vague. so i had to figure by myself, but this took me months to find out how to make it. as the progress of making health gui is almost done, i find it really struggling when coding to make stackable bars scale properly, and this is how the problem looks like:


(my attempt to use a roblox gear ceramic potion (which changes humanoid max health to 250) test health gui. after consuming gear, the health gui stacked two bars of life, the first life was yellow color and the second one was purple color)

id appreciate if someone helped me out, and here’s the place file: stackable_bar_health_gui.rbxl (44.3 KB)

For the stackable health, are you wanting to have like each individual be stacked on top of each other? Or am I getting the wrong idea?

i am not talking about the way bars stack each other, but the way they scale in each individual life. please read the thread again and carefully

Overcharge.rbxl (32.4 KB)

i dont think this is what i wanted, but thank you though

while there is no legitimate solution here, i decided to solve it by myself by tweaking criteria code. and here’s the result