How to make a part than can die

Hello. I was just wondering how you could make a part that has a healthbar like a Humanoid and if you use a sword on that part for example it would take damage.

Simply add a humanoid into that part [make it as a model],
about the swords - you can always adjust it to be whatever you want it.

So, you could use either Humanoid:TakeDamage(number) or set the Humanoid.Health -= number

I added a Humanoid to this Model but it wouldn’t show health, name, or anything.

This video shows what happens.

A humanoid may be one way to go about it, but if it’s just a part, and not a character, you can use attributes.

Just call SetAttribute on a part, specify a string denoting the name of the attribute, so in this case, “Health”, and set a value.

part:SetAttribute("Health", 100)

Attributes act as custom properties of objects in a way. You can get the current value by doing this:

part:GetAttribute("Health")

You need to have a HumanoidRootpart and a Head
Connect head to humanoidrootpart using motor 6D and that’s it.
The names are caps sensitive so you have to put them as in the first line.
Edit 3 (just in case) make everything inside a model and put the humanoid inside the model