I’m attempting to create a curved health bar using the clip descendants method discussed in this forum prior. However, I’m noticing that it’s not at all possible to do so with a curved image?
I was wondering if any skilled scripters have managed to find a way to do this? Please let me know thanks!
If the bar still fills either vertically or horizontally, you can use ImageRectSize and ImageRectOffset to control the clipping of an image manually.
Basically, if you want it to be 60% full, you resize the object to be 60% size, and adjust the ImageRect properties to only show the bottom 60% of the image.
If you fill radially, then this won’t exactly work.
Wouldn’t something work with if you have that overlay above, but then the blue area which I take indicates the health is empty. So that means you can make a frame like this.
If you put said frame under the overlay, and tween it, and use clip descendants, would that work?
You can tween the progress bar, and every time someone dies, take some of the bar away, whilst there being a IntValue which also gets taken away, and when the IntValue hits 0, you kill the player. Pretty simple!
Or you could have two frames and move the one respective to the health change, for example if the Health goes from 100 → 80, only the top would move, but 100 - > 25, both would change
It takes some knowledge and math experience to get it working right. These properties use integers for pixels, so you’ll need to know the size of the image that was uploaded.
For health, you’ll set the ImageRectSize to imageSizeX, imageSizeY*percent
and set ImageRectOffset to 0, imageSizeY*(1-percent)
As @VitalWinter has already stated, you need the size of the image that was uploaded. From here, you alter the ImageRectOffset to the image’s size, multiplied by the percentage of health the player has.
For example, the curve (in the viewport at least, again, you’ll need the size of the actual image), is 125 x 426. To fill half of the progress bar, you will take the Y size (426 pixels) and multiply it by the percentage of health. 426 * (humanoid.Health / humanoid.MaxHealth
As you’re resizing on the Y axis, the X component of ImageRectOffset is set to the image’s width in pixels (and remains unchanged). Your ImageRectOffset property should look like 125,213 in the event the player has 50% of their health. 213 comes from 426 * 0.5.
Note: You will also need to change the size of the GUI element to match.
I hope this cleared some things up and my information is accurate.