How to make an advanced health bar like this?

Hello, I’m trying to make an health bar like this: image

Basically what I’m trying to do is find out how do I make that type on health bar. Because in some games, their health bars are designed to be like that sometimes. (In some FPS games, you could encounter that kind of health bar)

As you can see there’s like the character outline while being filled with colors as it’s current health. In this case, yellow since the health is 40.

Uploaded these images to roblox and imported it to studio.

Outline: HP_FLINE_MasterPolice

The color background filling up the back (Behind the health outline):
HP_FEFFECT_MasterPolice

Those are the two images. First is the outline, second is the silhouette. The color of the current health. Now what I am trying to do is, I’m trying to put the color background behind the outline but instead it’s showing in front. Like do I have to re-arrange the order of the images in the hierarchy (explorer)? Even if I tried, it’s currently impossible to do that. Re-arranging images/objects like putting them under the current object as a second layer or something.

You can put the filled image in a ClipDescendants enabled frame, anchoring the frame to somewhere like (0, 1), then changing the Y size scale of the frame to change the fill amount.

1 Like

instead it’s showing in front.

Change the Z-Index.

1 Like

Hey @HexToast Now it somehow works. Now it does this:

Un-touched size (Default):

Tampered size:

Is there a way to only scale upper Y part not the lower Y part?

Set the anchor point to something like (0, 1) so that it remains at the bottom.

1 Like

@HexToast Can’t it be in like decimals? It has to be in integers so it’s exact?

@HexToast great now the image inside the Frame is moving along with it when I change the scale. What now?

What does it look like currently

@HexToast Decided to put every component into one frame together. So when I code it, I can just make it visible in one line of code.

image

The two images named “Outline” and “Background”, they have no anchor points and position set. They’re default to zero since they are parented to the Frame named “MasterPolice”. That main frame will handle the positioning and stuff.

Now the tricky part. The frame which acts like the health bar. The colored green which is highlighted in the Explorer:

As you said, set the AnchorPoint of the Y axis to 1. I did the same thing to the position so the position will go back to normal:
image

No X axis involved/tampered with. Now for the main course, scaling it up and down according to the Player’s health.

This is the default size: image
Now I set it to like 70 it looks like this:

Why?!?!? :tired_face:

Is your Zindex set so that it is under the covering image?

1 Like

@HexToast Yes the Frame has it’s Z index set to zero so it’s placed behind the outline image.

@HexToast If I change it so decimals like this: image

Now I set the offset Y scale to 70 and it becomes like this:

Looks fine, right? However, when I set it to lower, it’s gonna become like this:

Why is the bottom being affected…

You need to position the frame at 0, 0, 1, 0

1 Like

@HexToast same for the AnchorPoint? They have to be exact then. Also to make it easier for us to chat, do you have discord so I can just add you and we can talk there.

@HexToast I have set the AnchorPoint to 0,1 and the Position to {0,0,1,0}
That’s the current properties of the frame.

Now I change the Size to {0,200,0,150} it becomes like this:

HexToast#0001 is my discord tag.

1 Like

Managed to finally solve the problem. The bar is now staying on it’s own while being scaled up and downwards.

Thank you @7yoz for the Z index suggestion
Thank you @HexToast for the scaling and positioning stuff

Your suggestions are very helpful and I managed to finally solve the problem. Again, thank you guys!

Edit: The way I fixed it is kinda complicated.