I need help with my health Gui it's working at first but when I die it doesn't work anymore not even the tween nor the indicator

local Healthbar = script.Parent.Bar
local HealthIndicator = script.Parent.TextLabel
local hum = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")

while wait(0.01) do
	HealthIndicator.Text = ("%.0f"):format(hum.Health)
	Healthbar:TweenSize(UDim2.new(1/(hum.MaxHealth/hum.Health),0,1,0),"InOut","Sine",0.6)
	if hum.Health/hum.MaxHealth > 0.5 then
		Healthbar.BackgroundColor3 = Color3.fromRGB(107, 255, 84)
	end
	if hum.Health/hum.MaxHealth <= 0.5 then
		Healthbar.BackgroundColor3 = Color3.fromRGB(255, 61, 64)
	end
end

2 comments

0

There is a property in the ScreenGui object that you can turn off. I think it's ResetOnDeath or something

0

Try moving the local hum line inside the loop.