How to make a life bar with parts instead of frames?

I know how to make a life bar with frames, two of which are needed: The bar and the background; doing so adjusts itself because if you put something into the frame, the size of the inserted frame adapts to the parent frame. However, I don’t know how to apply this with parts instead of frames.

Cant you just create a series of cubes within a rectangular box and then delete them one at a time as the health drops until there are none left?