Hello everyone! So I've been spending the last few days figuring out how to fix my health bar GUI. So it is meant to smoothly decrease when the player takes damage. All that is working however, when a player takes damage twice or more without the script finishing its function, it all stops working. Please ask me any questions if you have any, and also the size of my health bar is {0,200}, {0, 100}.
--// Variables //-- local HUD = script.Parent local HealthBar = HUD.Health local Mob = Hud.Parent.Parent --Character local Humanoid = Mob.Humanoid local CurrentHealth = 100*2 -- Multiplying it by 2 to make it proportional to the length of the healthbar. --// Health //-- function HChanged() local Health = Humanoid.Health local Size = Health*2 for NewSize = CurrentHealth,Size,(-Health+10)/10 do HealthHud.Size = UDim2.new(0, NewSize,0,7) --// 7 is the width. wait() end CurrentHealth = Health*2 end HChanged() Humanoid.Changed:Connect(HChanged)