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

5 comments
Where is the script located?
The scale property is your best friend
Script located in side a ScreenGui
script looks good to me.
Make sure cardlevel is greater than 1.