Alright, so I have this health gui local script and it has the extra ability to identify the player's team by changing it's frame color for example to red or blue and the problem i'm having that it's not appearing when the player resets and there's no even a single error appearing in Output that I can idenfity it's problem, please help any kind of assistance would be appreciated.
while game.Workspace:FindFirstChild(game.Players.LocalPlayer.Name)==nil do game:GetService("RunService").RenderStepped:wait() end while game.Workspace:FindFirstChild(game.Players.LocalPlayer.Name):FindFirstChild("Humanoid")==nil do game:GetService("RunService").RenderStepped:wait() end script.Parent:WaitForChild("HPVisual") script.Parent:WaitForChild("HPLabel") script.Parent:WaitForChild("Critical") script.Parent:WaitForChild("HPOutline") script.Parent.Parent:WaitForChild("Background") coroutine.resume(coroutine.create(function() while true do game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, false) game:GetService("RunService").RenderStepped:wait() if script.Parent.HPVisual.ImageColor3==Color3.new(1,0,0) then if script.Parent.Critical.ImageTransparency==1 then script.Parent.Critical.ImageTransparency=0 else script.Parent.Critical.ImageTransparency=1 end wait(0.15) end end end)) game:GetService("RunService").RenderStepped:connect(function() if game.Players.LocalPlayer.Character.Humanoid.Health<=0 then script.Parent.Visible=false script.Parent.Parent.Background.Visible=false end script.Parent.Parent.Background.BackgroundColor3=game.Players.LocalPlayer.TeamColor.Color if game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:FindFirstChild("Humanoid") then local percent=(math.floor(game.Players.LocalPlayer.Character.Humanoid.Health)/math.floor(game.Players.LocalPlayer.Character.Humanoid.MaxHealth)) script.Parent.HPVisual.ImageRectOffset=Vector2.new(0,((1-percent)*100)) script.Parent.HPVisual.Size=UDim2.new(1,0,percent,0) script.Parent.HPVisual.Position=UDim2.new(0,0,1-percent,0) script.Parent.HPLabel.Text=math.floor(game.Players.LocalPlayer.Character.Humanoid.Health) if math.floor(game.Players.LocalPlayer.Character.Humanoid.Health)<2 and math.floor(game.Players.LocalPlayer.Character.Humanoid.Health)>0 then script.Parent.HPLabel.Text=1 end if percent<0.02 and percent>0 then percent=0.01 end if percent<=0.5 then script.Parent.HPVisual.ImageColor3=Color3.new(1,0,0) script.Parent.Critical.Visible=true else script.Parent.HPVisual.ImageColor3=Color3.new(1,1,1) script.Parent.Critical.Visible=false end end end)
I'm pretty sure there's an option you can tick on the gui if you want it to reset on player death. https://gyazo.com/5311b024e17c0bb3fbdd6d8f261ea493