Hi, I am making a mining system where a rock’s health is set via attributes. How do I subtract from the attribute value and check if its <= 0?
Hitbox.Touched:Connect(function(Mined : BasePart)
if Debounce and Mined:HasTag("Mineable") and not MiningEvent then
MiningEvent = true
HitSound:Play()
Mined:SetAttribute("MineableHealth", Mined:GetAttribute("MineableHealth" - Damage))
Mined.Size = Vector3.new(Mined.Size.X / 1.2, Mined.Size.Y / 1.2, Mined.Size.Y / 1.2)
if Mined:GetAttribute("MineableHealth" <= 0) then
Mined:Destroy()
end
task.wait(Cooldown)
MiningEvent = false
end
end)
