In my local script for a health bar I have, it seems to not be moving at all with the current code I have.
Here is the script:
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait() or workspace:WaitForChild(player.Name)
local humanoid = character:WaitForChild("Humanoid")
humanoid.HealthChanged:Connect(function(health)
script.Parent.Bar.Size = UDim2.new(health / humanoid.MaxHealth, 0, 1, 0)
if humanoid.Health / humanoid.MaxHealth > script.Parent.Damage.Size.X.Scale then
script.Parent.Damage.Size = UDim2.new(health / humanoid.MaxHealth, 0, 1, 0)
else
script.Parent.Damage:TweenSize(UDim2.new(health / humanoid.MaxHealth, 0, 1, 0), nil, Enum.EasingStyle.Linear, 0.5, true)
end
end)
player:WaitForChild("CombatTags").ChildAdded:Connect(function()
local cnum = #player.CombatTags:GetChildren()
if cnum == 0 then
script.Parent.Hint.Visible = false
else
script.Parent.Hint.Visible = true
end
end)
player:WaitForChild("CombatTags").ChildRemoved:Connect(function()
local cnum = #player.CombatTags:GetChildren()
if cnum == 0 then
script.Parent.Hint.Visible = false
else
script.Parent.Hint.Visible = true
end
end)
I have talked with serveral friends on this secetion of code and they as well see nothing wrong with it.

3 comments
What is the “script.Parent.Health.Damage.Size.X.Scale” on line 8 actually referring to?
Fixed. Still doesn't work however.
I didn't see an error for line 8, so I had no idea. Thank you for pointing it out.