-------------------------------------------------------------------
-----------------------[MEDSYSTEM]---------------------------------
-------------------------------------------------------------------


Evt.Ombro.OnServerEvent:Connect(function(Player,Vitima)
	local Nombre
	for SKP_001, SKP_002 in pairs(game.Players:GetChildren()) do
	if SKP_002:IsA('Player') and SKP_002 ~= Player and SKP_002.Name == Vitima then
		if SKP_002.Team == Player.Team then
			Nombre = Player.Name
		else
			Nombre = "Someone"
		end
		Evt.Ombro:FireClient(SKP_002,Nombre)
		end
	end
end)

Evt.Target.OnServerEvent:Connect(function(Player,Vitima)
	Player.Character.Saude.Variaveis.PlayerSelecionado.Value = Vitima
end)

Evt.Render.OnServerEvent:Connect(function(Player,Status,Vitima)
		if Vitima == "N/A" then
			Player.Character.Saude.Stances.Rendido.Value = Status
		else

			local VitimaTop = game.Players:FindFirstChild(Vitima)
		if VitimaTop.Character.Saude.Stances.Algemado.Value == false then
			VitimaTop.Character.Saude.Stances.Rendido.Value = Status
			VitimaTop.Character.Saude.Variaveis.HitCount.Value = 0
		end
	end
end)

Evt.Drag.OnServerEvent:Connect(function(player)
	local Human = player.Character.Humanoid
	local enabled = Human.Parent.Saude.Variaveis.Doer
	local MLs = Human.Parent.Saude.Variaveis.MLs
	local Caido = Human.Parent.Saude.Stances.Caido
	local Item = Human.Parent.Saude.Kit.Epinefrina


	local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
	
	if Caido.Value == false and target.Value ~= "N/A" then

		local player2 = game.Players:FindFirstChild(target.Value)
		local PlHuman = player2.Character.Humanoid

		local Sangrando = PlHuman.Parent.Saude.Stances.Sangrando
		local MLs = PlHuman.Parent.Saude.Variaveis.MLs
		local Dor = PlHuman.Parent.Saude.Variaveis.Dor
		local Ferido = PlHuman.Parent.Saude.Stances.Ferido
		local PlCaido = PlHuman.Parent.Saude.Stances.Caido
		local Sang = PlHuman.Parent.Saude.Variaveis.Sangue
		
		if enabled.Value == false then
	
		if PlCaido.Value == true or PlCaido.Parent.Algemado.Value == true then 
		enabled.Value = true	
		
		coroutine.wrap(function()
        while target.Value ~= "N/A" and PlCaido.Value == true and PlHuman.Health > 0 and Human.Health > 0 and Human.Parent.Saude.Stances.Caido.Value == false or target.Value ~= "N/A" and PlCaido.Parent.Algemado.Value == true do wait() pcall(function()
                player2.Character.Torso.Anchored ,player2.Character.Torso.CFrame = true,Human.Parent.Torso.CFrame*CFrame.new(0,0.75,1.5)*CFrame.Angles(math.rad(0), math.rad(0), math.rad(90))
				enabled.Value = true
        end) end
        pcall(function() player2.Character.Torso.Anchored=false
		enabled.Value = false
		end)
		end)()
		
		enabled.Value = false
		end	
		end	
	end
end)

Evt.Squad.OnServerEvent:Connect(function(Player,SquadName,SquadColor)
	Player.Character.Saude.FireTeam.SquadName.Value = SquadName
	Player.Character.Saude.FireTeam.SquadColor.Value = SquadColor
end)

Evt.Afogar.OnServerEvent:Connect(function(Player)
	Player.Character.Humanoid.Health = 0
end)
