npc=nil hum=nil health_gui=script.Parent health_text=script.Parent:WaitForChild("\084\101\120\116\076\097\098\101\108")if health_gui.Parent~=nil and(health_gui.Parent.ClassName=="\077\111\100\101\108"and health_gui.Parent:FindFirstChildOfClass("\072\117\109\097\110\111\105\100"))then npc=health_gui.Parent hum=health_gui.Parent:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")elseif health_gui.Parent.Parent~=nil and(health_gui.Parent.Parent.ClassName=="\077\111\100\101\108"and health_gui.Parent.Parent:FindFirstChildOfClass("\072\117\109\097\110\111\105\100"))then npc=health_gui.Parent.Parent hum=health_gui.Parent.Parent:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")elseif health_gui.Parent.Parent.Parent~=nil and(health_gui.Parent.Parent.Parent.ClassName=="\077\111\100\101\108"and health_gui.Parent.Parent.Parent:FindFirstChildOfClass("\072\117\109\097\110\111\105\100"))then npc=health_gui.Parent.Parent.Parent hum=health_gui.Parent.Parent.Parent:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")end if not npc then health_gui:Remove()end if not hum then health_text.Text="\104\117\109\097\110\111\105\100 \110\111\116 \102\111\117\110\100"health_text.TextColor3=Color3.fromRGB(255,255,127)end hum.DisplayDistanceType=Enum.HumanoidDisplayDistanceType.None hum.HealthDisplayType=Enum.HumanoidHealthDisplayType.AlwaysOff game["\082\117\110 \083\101\114\118\105\099\101"].Heartbeat:Connect(function()health_text.Text=npc.Name..(" \124 "..(hum.Health..(" \047 "..hum.MaxHealth)))local Q=Color3.fromRGB(85,255,127)local c=Color3.fromRGB(255,255,127)local k=Color3.fromRGB(255,140,142)if hum.Health>=hum.MaxHealth*.6 then health_text.TextColor3=Q end if hum.Health<=hum.MaxHealth*.6 then health_text.TextColor3=c end if hum.Health<=hum.MaxHealth*.25 then health_text.TextColor3=k end end)
--updated 10/09/2022

npc = nil
hum = nil
health_gui = script.Parent
health_text = script.Parent:WaitForChild("TextLabel")

if
	health_gui.Parent ~= nil
	and health_gui.Parent.ClassName == "Model"
	and health_gui.Parent:FindFirstChildOfClass("Humanoid")
then
	npc = health_gui.Parent
	hum = health_gui.Parent:FindFirstChildOfClass("Humanoid")
elseif
	health_gui.Parent.Parent ~= nil
	and health_gui.Parent.Parent.ClassName == "Model"
	and health_gui.Parent.Parent:FindFirstChildOfClass("Humanoid")
then
	npc = health_gui.Parent.Parent
	hum = health_gui.Parent.Parent:FindFirstChildOfClass("Humanoid")
elseif
	health_gui.Parent.Parent.Parent ~= nil
	and health_gui.Parent.Parent.Parent.ClassName == "Model"
	and health_gui.Parent.Parent.Parent:FindFirstChildOfClass("Humanoid")
then
	npc = health_gui.Parent.Parent.Parent
	hum = health_gui.Parent.Parent.Parent:FindFirstChildOfClass("Humanoid")
end

if not npc then
	health_gui:Remove()
end

if not hum then
	health_text.Text = "humanoid not found"
	health_text.TextColor3 = Color3.fromRGB(255, 255, 127)
end

hum.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
hum.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff

game["Run Service"].Heartbeat:Connect(function()
	--for text health
	health_text.Text = npc.Name .. " | " .. hum.Health .. " / " .. hum.MaxHealth

	--for color
	local GoodColor = Color3.fromRGB(85, 255, 127)
	local MediumColor = Color3.fromRGB(255, 255, 127)
	local BadColor = Color3.fromRGB(255, 140, 142)

	if hum.Health >= hum.MaxHealth * 0.6 then
		health_text.TextColor3 = GoodColor
	end

	if hum.Health <= hum.MaxHealth * 0.6 then
		health_text.TextColor3 = MediumColor
	end

	if hum.Health <= hum.MaxHealth * 0.25 then
		health_text.TextColor3 = BadColor
	end
end)
