local plr = game.Players.LocalPlayer.Character while true do script.Parent:TweenSize(UDim2.new(plr.Humanoid.Health/plr.Humanoid.MaxHealth, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.1) wait(0.1) end
and the error it gives is
Humanoid is not a valid member of Model
You should use WaitForChild to wait for the Humanoid. You should also use .Changed on the humanoid to check when the health changes, not loop, it will result in higher performance. Here is what I would do:
local plr = game.Players.LocalPlayer.Character local human = plr:WaitForChild('Humanoid') human.Changed:connect(function() script.Parent:TweenSize(UDim2.new(human.Health/human.MaxHealth, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.1) end)