This is a script in a health GUI but there's a delay when the health is changed.
local Player = script.Parent.Parent.Parent.Parent
local Char = Player.Character
local Humanoid = Char:findFirstChild("Humanoid")
local HealthBar = script.Parent.HealthBar
local HealthPosition = UDim2.new(0.345,0,0.5,-10)
local HealthSize = UDim2.new(0,220,0,20)
local EnergyBar = script.Parent.EnergyBar
Humanoid.Changed:connect(function(Change)
if Change == "Health" then
local HP = Humanoid.Health
HealthBar:TweenSize(UDim2.new(0.0088*HP,0,0,20), "Out", "Quad",0.4, true)
end
end)
