------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------


local Functions = Evt.MedSys
local FunctionsMulti = Evt.MedSys.Multi

local Compress = Functions.Compress
local Bandage = Functions.Bandage
local Splint = Functions.Splint
local PainKiller = Functions.PainKiller
local Energetic = Functions.Energetic
local Tourniquet = Functions.Tourniquet

local Compress_Multi = FunctionsMulti.Compress
local Bandage_Multi = FunctionsMulti.Bandage
local Splint_Multi = FunctionsMulti.Splint
local Epinephrine_Multi = FunctionsMulti.Epinephrine
local Morphine_Multi = FunctionsMulti.Morphine
local BloodBag_Multi = FunctionsMulti.BloodBag
local Tourniquet_Multi = FunctionsMulti.Tourniquet

local Algemar = Functions.Algemar
local Fome = Functions.Fome
local Stance = Evt.MedSys.Stance
local Collapse = Functions.Collapse
local Reset = Functions.Reset
local TS = game:GetService("TweenService")

Compress.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

	if enabled.Value == false and Caido.Value == false then
	
		if MLs.Value >= 2 then 
		enabled.Value = true
		
		wait(.3)		
		
		MLs.Value = 1
			
		wait(5)
		enabled.Value = false
	
		end	
	end
end)

Bandage.OnServerEvent:Connect(function(player)


	local Human = player.Character.Humanoid
	local enabled = Human.Parent.Saude.Variaveis.Doer
	local Sangrando = Human.Parent.Saude.Stances.Sangrando
	local MLs = Human.Parent.Saude.Variaveis.MLs
	local Caido = Human.Parent.Saude.Stances.Caido
	local Ferido = Human.Parent.Saude.Stances.Ferido

	local Bandagens = Human.Parent.Saude.Kit.Bandagem

	if enabled.Value == false and Caido.Value == false  then
	
		if Bandagens.Value >= 1 and Sangrando.Value == true then 
		enabled.Value = true

		wait(.3)		
		
		Sangrando.Value = false
		Bandagens.Value = Bandagens.Value - 1 
		
		
		wait(2)
		enabled.Value = false
	
		end	
	end	
end)

Splint.OnServerEvent:Connect(function(player)


	local Human = player.Character.Humanoid
	local enabled = Human.Parent.Saude.Variaveis.Doer
	local Sangrando = Human.Parent.Saude.Stances.Sangrando
	local MLs = Human.Parent.Saude.Variaveis.MLs
	local Caido = Human.Parent.Saude.Stances.Caido
	local Ferido = Human.Parent.Saude.Stances.Ferido

	local Bandagens = Human.Parent.Saude.Kit.Splint

	if enabled.Value == false and Caido.Value == false  then
	
		if Bandagens.Value >= 1 and Ferido.Value == true  then 
		enabled.Value = true
		
		wait(.3)		
		
		Ferido.Value = false 
		
		Bandagens.Value = Bandagens.Value - 1 
		
		
		wait(2)
		enabled.Value = false
	
		end	
	end	
end)

PainKiller.OnServerEvent:Connect(function(player)


	local Human = player.Character.Humanoid
	local enabled = Human.Parent.Saude.Variaveis.Doer
	local Sangrando = Human.Parent.Saude.Stances.Sangrando
	local MLs = Human.Parent.Saude.Variaveis.MLs
	local Dor = Human.Parent.Saude.Variaveis.Dor
	local Caido = Human.Parent.Saude.Stances.Caido
	local Ferido = Human.Parent.Saude.Stances.Ferido

	local Bandagens = Human.Parent.Saude.Kit.Aspirina

	if enabled.Value == false and Caido.Value == false  then
	
		if Bandagens.Value >= 1  and Dor.Value >= 1  then
		enabled.Value = true
		
		wait(.3)		
		
		Dor.Value = Dor.Value - math.random(60,75)
		
		Bandagens.Value = Bandagens.Value - 1 
		
		
		wait(2)
		enabled.Value = false
	
		end	
	end	
end)

Energetic.OnServerEvent:Connect(function(player)


	local Human = player.Character.Humanoid
	local enabled = Human.Parent.Saude.Variaveis.Doer
	local Sangrando = Human.Parent.Saude.Stances.Sangrando
	local MLs = Human.Parent.Saude.Variaveis.MLs
	local Dor = Human.Parent.Saude.Variaveis.Dor
	local Caido = Human.Parent.Saude.Stances.Caido
	local Ferido = Human.Parent.Saude.Stances.Ferido

	local Bandagens = Human.Parent.Saude.Kit.Energetico
	--local Energia = Human.Parent.Saude.Variaveis.Energia

	if enabled.Value == false and Caido.Value == false  then
	
		if Human.Health < Human.MaxHealth  then
		enabled.Value = true
		
		wait(.3)		
		
		Human.Health = Human.Health + (Human.MaxHealth/3)
		--Energia.Value = Energia.Value + (Energia.MaxValue/3)
		Bandagens.Value = Bandagens.Value - 1
		
		
		wait(2)
		enabled.Value = false
	
		end	
	end	
end)

Tourniquet.OnServerEvent:Connect(function(player)


	local Human = player.Character.Humanoid
	local enabled = Human.Parent.Saude.Variaveis.Doer
	local Sangrando = Human.Parent.Saude.Stances.Sangrando
	local MLs = Human.Parent.Saude.Variaveis.MLs
	local Dor = Human.Parent.Saude.Variaveis.Dor
	local Caido = Human.Parent.Saude.Stances.Caido
	local Ferido = Human.Parent.Saude.Stances.Ferido

	local Bandagens = Human.Parent.Saude.Kit.Tourniquet

if Human.Parent.Saude.Stances.Tourniquet.Value == false then
	if enabled.Value == false and Sangrando.Value == true and Bandagens.Value > 0 then
		enabled.Value = true
		
		wait(.3)		
		
		Human.Parent.Saude.Stances.Tourniquet.Value = true
		Bandagens.Value = Bandagens.Value - 1
		
		
		wait(2)
		enabled.Value = false
		
	end	
else
	if enabled.Value == false then
		enabled.Value = true
		
		wait(.3)		
		
		Human.Parent.Saude.Stances.Tourniquet.Value = false
		Bandagens.Value = Bandagens.Value + 1
		
		
		wait(2)
		enabled.Value = false
	end
end
end)
