I'm making a card game and I'm trying to add a health to the card. Here's the script;
local healthbar = script.Parent.Parent:WaitForChild("HealthBar") local currenthealth = script.Parent:WaitForChild("CurrentHealth") local maxhealth = script.Parent:WaitForChild("MaxHealth") local cardlevel = script.Parent.Parent.Parent.CardLevel:WaitForChild("CardLv") local cardhealthtext = script.Parent while true do wait(0.1) cardhealthtext.Text = currenthealth.Value.." / "..maxhealth.Value if cardlevel.Value > 1 then maxhealth.Value = maxhealth.Value + (cardlevel.Value * 2) local Health = currenthealth.Value / maxhealth.Value healthbar.Size = UDim2.new(Health, 0, 1, 0) end end
There was no errors but the health bar won't change sizes, Please help
Multiply the percentage by the size of the health bar at max
local Health = currenthealth.Value / maxhealth.Value healthbar.Size = UDim2.new(Health * maximumSize, 0, 1, 0)