-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
local Vida = script.Parent.Overhaul.Vida
local Consciente = script.Parent.Overhaul.Consciente
local Dor = script.Parent.Overhaul.Dor
local Ferido = script.Parent.Overhaul.Ferido
local Sangrando = script.Parent.Overhaul.Sangrando

local BleedTween = TS:Create(Sangrando, TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,-1,true), {TextColor3 =  Color3.fromRGB(255, 0, 0)} )

RS.RenderStepped:connect(function()
	if script.Parent.Visible == true then
		
	if Target.Value ~= "N/A" then

		local player = game.Players:FindFirstChild(Target.Value)	
		local vHuman = player.Character.Humanoid
		local vSang = player.Character.Saude.Variaveis.Sangue
	
		local pie = (vHuman.Health / vHuman.MaxHealth)
		script.Parent.Menu.Base.VidaBar.Sangue.Size = UDim2.new(1, 0, -pie, 0)

		local Pizza = (vSang.Value / vSang.MaxValue)
		script.Parent.Menu.Base.SangueBar.Sangue.Size = UDim2.new(1, 0, -Pizza, 0)

	else

		local pie = (Human.Health / Human.MaxHealth)
		script.Parent.Menu.Base.VidaBar.Sangue.Size = UDim2.new(1, 0, -pie, 0)

		local Pizza = (Saude.Variaveis.Sangue.Value / Saude.Variaveis.Sangue.MaxValue)
		script.Parent.Menu.Base.SangueBar.Sangue.Size = UDim2.new(1, 0, -Pizza, 0)

	end
		
		
		if Target.Value == "N/A" then
			if Human.Health <= 0 then
				Vida.Text = "Dead"
				Vida.TextColor3 = Color3.fromRGB(255,0,0)
			elseif Human.Health <= (Human.MaxHealth * .5) then
				Vida.Text = "High Risk"
				Vida.TextColor3 = Color3.fromRGB(255,0,0)
			elseif Human.Health <= (Human.MaxHealth * .75) then
				Vida.Text = "Low Risk"
				Vida.TextColor3 = Color3.fromRGB(255,255,0)
			elseif Human.Health <= (Human.MaxHealth) then
				Vida.Text = "Healthy"
				Vida.TextColor3 = Color3.fromRGB(255,255,255)
			end
		
			if Saude.Stances.Caido.Value == true then
				Consciente.Text = "Unconscious"
			else
				Consciente.Text = "Conscious"
			end

			if Saude.Variaveis.Dor.Value <= 0 then
				Dor.Text = "No pain"
				Dor.TextColor3 = Color3.fromRGB(255,255,255)
			elseif Saude.Variaveis.Dor.Value <= 25 then
				Dor.Text = "Minor pain"
				Dor.TextColor3 = Color3.fromRGB(255,255,255)
			elseif Saude.Variaveis.Dor.Value < 100 then
				Dor.Text = "Major pain"
				Dor.TextColor3 = Color3.fromRGB(255,255,0)
			elseif Saude.Variaveis.Dor.Value >= 100 then
				Dor.Text = "Extreme pain"
				Dor.TextColor3 = Color3.fromRGB(255,0,0)
			end


			if Saude.Stances.Ferido.Value == true then
				Ferido.Visible = true
			else
				Ferido.Visible = false
			end

			if Saude.Stances.Sangrando.Value == true or Saude.Stances.Tourniquet.Value == true then
				if Saude.Stances.Tourniquet.Value == true then
					Sangrando.Text = 'Tourniquet'
				else
					Sangrando.Text = 'Bleeding'
				end
				Sangrando.Visible = true
				Sangrando.TextColor3 = Color3.fromRGB(255,255,255)
				BleedTween:Play()
			else
				Sangrando.Visible = false
				BleedTween:Cancel()
			end
		
		else
			local player2 = game.Players:FindFirstChild(Target.Value)
			local PlHuman = player2.Character.Humanoid
			local PlSaude = player2.Character.Saude
			if PlHuman.Health > 0 then
			if PlHuman.Health <= 0 then
				Vida.Text = "Dead"
				Vida.TextColor3 = Color3.fromRGB(255,0,0)
			elseif PlHuman.Health <= (PlHuman.MaxHealth * .5) then
				Vida.Text = "High Risk"
				Vida.TextColor3 = Color3.fromRGB(255,0,0)
			elseif PlHuman.Health <= (PlHuman.MaxHealth * .75) then
				Vida.Text = "Low Risk"
				Vida.TextColor3 = Color3.fromRGB(255,255,0)
			elseif PlHuman.Health <= (PlHuman.MaxHealth) then
				Vida.Text = "Healthy"
				Vida.TextColor3 = Color3.fromRGB(255,255,255)
			end

			if PlSaude.Stances.Caido.Value == true then
				Consciente.Text = "Unconscious"
			else
				Consciente.Text = "Conscious"
			end
	
			if PlSaude.Variaveis.Dor.Value <= 0 then
				Dor.Text = "No pain"
				Dor.TextColor3 = Color3.fromRGB(255,255,255)
			elseif PlSaude.Variaveis.Dor.Value <= 25 then
				Dor.Text = "Minor pain"
				Dor.TextColor3 = Color3.fromRGB(255,255,255)
			elseif PlSaude.Variaveis.Dor.Value < 100 then
				Dor.Text = "Major pain"
				Dor.TextColor3 = Color3.fromRGB(255,255,0)
			elseif PlSaude.Variaveis.Dor.Value >= 100 then
				Dor.Text = "Extreme pain"
				Dor.TextColor3 = Color3.fromRGB(255,0,0)
			end
	
			if PlSaude.Stances.Ferido.Value == true then
				Ferido.Visible = true
			else
				Ferido.Visible = false
			end
	
			if PlSaude.Stances.Sangrando.Value == true or PlSaude.Stances.Tourniquet.Value == true then
				if PlSaude.Stances.Tourniquet.Value == true then
					Sangrando.Text = 'Tourniquet'
				else
					Sangrando.Text = 'Bleeding'
				end
				Sangrando.Visible = true
				Sangrando.TextColor3 = Color3.fromRGB(255,255,255)
				BleedTween:Play()
			else
				Sangrando.Visible = false
				BleedTween:Cancel()
			end
			else
				Reset:FireServer()
			end
		end
	end

end)