null nil false HealthScript v2.0 local humanoid = script.Parent.Humanoid if (humanoid == nil) then print("ERROR: no humanoid found in 'HealthScript v2.0'") end function CreateGUI() local p = game.Players:GetPlayerFromCharacter(humanoid.Parent) print("Health for Player: " .. p.Name) script.HealthGUI.Parent = p.PlayerGui end function UpdateGUI(health) local pgui = game.Players:GetPlayerFromCharacter(humanoid.Parent).PlayerGui local tray = pgui.HealthGUI.Tray tray.HealthBar.Size = UDim2.new(0.2, 0, 0.8 * (health / humanoid.MaxHealth), 0) tray.HealthBar.Position = UDim2.new(0.4, 0, 0.8 * (1- (health / humanoid.MaxHealth)) , 0) end function HealthChanged(health) UpdateGUI(health) end CreateGUI() humanoid.HealthChanged:connect(HealthChanged) humanoid.Died:connect(function() HealthChanged(0) end) true HealthGUI true false 4285215356 1 4279970357 1 Tray 0.949999988 0 0.380000025 0 0.0450000018 0 0.340000004 0 0 true 1 true false 4294967295 1 4279970357 1 http://www.roblox.com/asset/?id=18441769 ImageLabel 0 0 0.800000012 3 1 0 0.25 0 1 true 1 true false 4286892054 0 4278190080 0 HealthBar 0.420000017 0 0 0 0.159999996 0 0.800000012 0 0 true 2 true false 4289733411 0 4278190080 0 HealthBarBacking 0.419999987 0 0 0 0.159999996 0 0.800000012 0 0 true 1 true false Health function waitForChild(parent, childName) local child = parent:findFirstChild(childName) if child then return child end while true do child = parent.ChildAdded:wait() if child.Name==childName then return child end end end -- declarations local Figure = script.Parent local Head = waitForChild(Figure, "Head") local Humanoid = waitForChild(Figure, "Humanoid") -- regeneration while true do local s = wait(1) local health = Humanoid.Health if health > 0 and health < Humanoid.MaxHealth then health = health + 0.01 * s * Humanoid.MaxHealth if health * 1.05 < Humanoid.MaxHealth then Humanoid.Health = health else Humanoid.Health = Humanoid.MaxHealth end end end true