How to clip Gui only using scale

I have two images of a progress bar, one being full and one being empty.

Full one:


Empty one:

Now I want the GUI to clip so for example if the progress is halfway through you see half of the full one and half of the empty one but so far I have only seen this done using ClipDescendants.

But as far as I know for that you need to use offset on the size of the image you want to clip but I am using a BillboardGui and I want to keep it on scale. Is there any way to achieve this only using scale?

if there is not, is my only way to just create 12 separate images for each progress bar and just swap the images? Cause I’m fine with that as well.

Alright so I did already fix this by using a different method of just basically creating 24 images which each different state of progress and just swapping the images and I am happy with the results but if you still know a way let me know!

1 Like

Yeah, that’s about the only way to do it.

What if when you change the size of the clipper you also change the size of the foreground?

So for example you want the bar to be 50% you can do

local perc = .5

clipper.Size = UDim2.fromScale(perc, 1)

foreground.Size = UDim2.fromScale(1 / perc, 1)

This would make the foreground’s size {2, 0}, {1, 0} so that it stays the same size as the background.

You can do it by having your image inside a Frame with ClipsDescendants enabled, then move the image forward and frame back same amount, for example if you want progress to be 50% you would move frame to (-0.5,0,0,0) and image to (0.5,0,0,0).

If all the bars are a separate image from the background, you could use a UIGradient object and use it to change the colors by adjusting the Offset and numbersequence Color property, you could also have two images and do the same thing with the UIGradient but do it with Transparency instead while having the full one on top but have the Transparency reveal the empty one below it. There are a few tutorials on how to do similar things (i.e. look at circular bar tutorials to understand manipulating the Offset/Transparency/Color) on the devforum if you can’t figure it out yourself.