I don't know why this isn't working, it was working before. It doesn't seem to reset after I die. It did like 3 hours ago though.
game.Players.LocalPlayer.Character.Humanoid.Changed:connect(function() script.Parent.Size = UDim2.new(game.Players.LocalPlayer.Character.Humanoid.Health / game.Players.LocalPlayer.Character.Humanoid.MaxHealth,0,0,20) script.Parent.TextLabel.Text = math.floor(game.Players.LocalPlayer.Character.Humanoid.Health) if game.Players.LocalPlayer.Character.Humanoid.Health < 25 then script.Parent.BackgroundColor3 = Color3.new(255,0,255) else if game.Players.LocalPlayer.Character.Humanoid.Health > 25 then script.Parent.BackgroundColor3 = Color3.new(0, 255, 0) end end end) while true do if game.Players.LocalPlayer.Humanoid.Health == 100 then script.Parent.Size = UDim2.new(1, 0, 0, 20) script.Parent.BackgroundColor3 = Color3.new(0, 255, 0) end wait() end
You can manually view the properties of StarterGui and make sure "ResetPlayerGuiOnSpawn" is checked or else it won't reset after death.
OR
You can implement it in a script using this code in your health script!
local starterGui = game:GetService("StarterGui") starterGui.ResetPlayerGuiOnSpawn = true