Code Generator | Lua

Roblox Kill Tracking Script Update

This Lua script enhances a Roblox game by implementing a kill tracking system that updates player stats. When a player kills another, they receive +1 kill and +10 points, with their leaderboard updated accordingly.


Empty image or helper icon

Prompt

local Engine = game.ReplicatedStorage:WaitForChild("ACS_Engine")
local Evt = Engine:WaitForChild("Eventos")
local Mod = Engine:WaitForChild("Modulos")
local GunModels = Engine:WaitForChild("GunModels")
local GunModelClient = GunModels:WaitForChild("Client")
local GunModelServer = GunModels:WaitForChild("Server")
local Ultil = require(Mod:WaitForChild("Utilities"))
local ServerConfig = require(Engine.ServerConfigs:WaitForChild("Config"))

game.ReplicatedStorage:WaitForChild('ACS_Engine'):WaitForChild('Eventos'):WaitForChild('SetLight').OnServerEvent:Connect(function(plr,pr,key,val,part)
    if plr.Character and plr.Character:FindFirstChild('S' .. pr) then
        local p = plr.Character['S' .. pr]
        for _,v in pairs(p:GetChildren()) do
            if v.Name == "GLaser" and v.Key.Value == key then
                v.Enabled.Value = val
            elseif v.Name == "GFlash" and v.Key.Value == key  then
                v.Enabled.Value = val
                for _,v in pairs(v:GetDescendants()) do
                    if v:IsA('SpotLight') or v:IsA('PointLight') or v:IsA('SurfaceLight') then
                        v.Enabled = val
                    end
                end
            end
        end
        --		pr = plr.Character['S' .. pr] and plr.Character['S' .. pr]:FindFirstChild(part) and plr.Character['S' .. pr]:FindFirstChild(part):FindFirstChild('Enabled')
        --		if pr:IsDescendantOf(plr.Character) and pr.Parent.Name == part.Name and pr.Name == 'Enabled' then
        --			pr.Value = val
        --			for _,v in pairs(pr.Parent:GetDescendants()) do
        --				if v:IsA('SpotLight') or v:IsA('PointLight') or v:IsA('SurfaceLight') then
        --					v.Enabled = val
        --				end
        --			end
        --		end
    end
end)

game.ReplicatedStorage:WaitForChild('ACS_Engine'):WaitForChild('Eventos'):WaitForChild('Muzzle').OnServerEvent:Connect(function(plr,part)
    local found = nil
    for _,v in pairs(plr.Character:GetDescendants()) do
        if v.Name == 'SmokePart' then
            found = v
        end
    end
    local grip = nil
    for _,v in pairs(plr.Character:GetDescendants()) do
        if v.Name == 'Grip' then
            grip = v
        end
    end
    if found then
        for _,v in pairs(game.Players:GetPlayers()) do
            if v ~= plr then
                game.ReplicatedStorage:WaitForChild('ACS_Engine'):WaitForChild('Eventos'):WaitForChild('Muzzle'):FireClient(v,found)
            end
        end
    end
    if grip then
        for _,v in pairs(game.Players:GetPlayers()) do
            if v ~= plr then
                game.ReplicatedStorage:WaitForChild('ACS_Engine'):WaitForChild('Eventos'):WaitForChild('Muzzle'):FireClient(v,grip)
            end
        end
    end
end)

local Players = game.Players
local ACS_Storage = workspace:WaitForChild("ACS_WorkSpace")


local Debris = game:GetService("Debris")

local Left_Weld, Right_Weld,RA,LA,RightS,LeftS,HeadBase,HW,HW2
local AnimBase,AnimBaseW,NeckW

local RS = game:GetService("RunService")

local Glass = {"1565824613"; "1565825075";}
local Sand = {"2454393686"; "2454393865"; "2454394068"; "2454394411"; "2454403475";} -- Sand
local Snow = {"2454393686"; "2454393865"; "2454394068"; "2454394411"; "2454403475";} -- Sand
local Dirt = {"2454383086"; "2454383273"; "2454383478"; "2454383707"; "2454383881";}
local Metal = {"4668972968"; "4668973190"; "4668973339"; "4668973523"; "4668973734"; "871704395";}
local Grass = {"1565830611"; "1565831129"; "1565831468"; "1565832329";}
local Wood = {"287772625"; "287772674"; "287772718"; "287772829"; "287772902";}
local Concrete = {"4668967717"; "4668967993"; "4668968189"; "4668968550"; "4668968686";  "871701346";}
local Explosion = {"287390459"; "287390954"; "287391087"; "287391197"; "287391361"; "287391499"; "287391567";}
local Cracks = {"476816723"; "476816783"; "476816854"; "476817887"; "476817935"; "476818012";} -- Bullet Cracks
local Hits = {"4635529230"; "4635529434"; "4635529646"; "4635529872";} -- Player
local Headshot = {"1565836522"; "1565837588"; "1565734495"; "1565734259"; "3744371091";"3744371342";"3744371584";"3744371864";} -- Headshot sound
local Whizz = {"4398258464"; "4398257449"; "4398256665"; "4398255798"; "4398254253"; "4398253413";} -- Bullet Whizz

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


local BulletModel =  ACS_Storage.Server

game.Players.PlayerAdded:connect(function(SKP_001)	
    SKP_001.CharacterAppearanceLoaded:Connect(function(SKP_002)

        for SKP_003, SKP_004 in pairs(Engine.Essential:GetChildren()) do
            if SKP_004 then
                local SKP_005 = SKP_004:clone()
                SKP_005.Parent = SKP_001.PlayerGui
                SKP_005.Disabled = false
            end
        end

        if SKP_001.Character:FindFirstChild('Head') then
            --Evt.TeamTag:FireAllClients(SKP_001, SKP_002)
        end
    end)

    SKP_001.Changed:connect(function()
        --Evt.TeamTag:FireAllClients(SKP_001)
    end)

end)

function Weld(SKP_001, SKP_002, SKP_003, SKP_004)
    local SKP_005 = Instance.new("Motor6D", SKP_001)
    SKP_005.Part0 = SKP_001
    SKP_005.Part1 = SKP_002
    SKP_005.Name = SKP_001.Name
    SKP_005.C0 = SKP_003 or SKP_001.CFrame:inverse() * SKP_002.CFrame
    SKP_005.C1 = SKP_004 or CFrame.new()
    return SKP_005
end


Evt.Recarregar.OnServerEvent:Connect(function(Player, StoredAmmo,Arma)
    Arma.ACS_Modulo.Variaveis.StoredAmmo.Value = StoredAmmo
end)

Evt.Treino.OnServerEvent:Connect(function(Player, Vitima)

    if Vitima.Parent:FindFirstChild("Saude") ~= nil then
        local saude = Vitima.Parent.Saude
        saude.Variaveis.HitCount.Value = saude.Variaveis.HitCount.Value + 1
    end

end)

game.ReplicatedStorage:WaitForChild('ACS_Engine'):WaitForChild('Eventos'):WaitForChild('V').OnServerEvent:Connect(function(plr,hum)
    if not hum.Parent:FindFirstChildOfClass('ForceField') then
        if not hum:FindFirstChild('Inc') then
            local b = Instance.new('BoolValue')
            b.Value = true
            b.Name = 'Inc'
            b.Parent = hum
        end
        warn("xdd")
        hum:TakeDamage(100)
    end
end)

game.ReplicatedStorage:WaitForChild('ACS_Engine'):WaitForChild('Eventos'):WaitForChild('Sxp').OnServerEvent:Connect(function(plr,hum,dist)
    if hum then
        local distance_factor = dist / 25    -- get the distance as a value between 0 and 1
        distance_factor = 1 - distance_factor                         -- flip the amount, so that lower == closer == more damage
        if distance_factor > 0 then
            warn("xdd")
            hum:TakeDamage(100*distance_factor)        -- 0: no damage; 1: max damage
        end
    end
end)

game.ReplicatedStorage:WaitForChild('ACS_Engine'):WaitForChild('Eventos'):WaitForChild('SpecialFire').OnServerEvent:Connect(function(plr,ig,sett,cframe,g)
    ig = ig or {}
    local i = {}
    for g,v in pairs(ig) do
        i[g] = v
    end
    i[#i+1] = plr.Character
    for _,v in pairs(game.Players:GetPlayers()) do
        if v ~= plr then
            game.ReplicatedStorage:WaitForChild('ACS_Engine'):WaitForChild('Eventos'):WaitForChild('SpecialFire'):FireClient(v,i,sett,cframe,plr,g)
        end
    end
end)

Evt.Whizz.OnServerEvent:Connect(function(Player, Vitima)
    local Som = Instance.new('Sound')
    Som.Parent = Vitima.PlayerGui
    Som.SoundId = "rbxassetid://"..Whizz[math.random(1,4)]
    Som.Volume = 2
    Som:Play()
    local m = wait()
    game.Debris:AddItem(Som, Som.TimeLength-m)
end)

local function crack(plr)
    local Som = Instance.new('Sound')
    Som.Parent = plr.PlayerGui
    Som.SoundId = "rbxassetid://"..Cracks[math.random(1,4)]
    Som.Volume = 4
    Som:Play()
    local m = wait()
    game.Debris:AddItem(Som, Som.TimeLength-m)
end

local function ring(plr)
    local Som = Instance.new('Sound')
    Som.Parent = plr.PlayerGui
    Som.SoundId = "rbxassetid://"..Rings[math.random(1,4)]
    Som.Volume = 3
    Som:Play()
    local m = wait()
    game.Debris:AddItem(Som, Som.TimeLength-m)
end

Evt.Crack.OnServerEvent:Connect(function(Player, Vitima)
    crack(Vitima)
end)

Evt.ServerBullet.OnServerEvent:connect(function(plr,pos,dir,sts,zero)
    if ServerConfig.ReplicatedBullets then
        for _,v in pairs(game.Players:GetPlayers()) do
            if v ~= plr then
                Evt.ServerBullet:FireClient(v,pos,dir,plr.Character,sts,zero)
            end
        end
    end
end)

Evt.Equipar.OnServerEvent:Connect(function(Player,Arma)

    local Torso = Player.Character:FindFirstChild('Torso')
    local Head = Player.Character:FindFirstChild('Head')
    local HumanoidRootPart = Player.Character:FindFirstChild('HumanoidRootPart')

    if Player.Character:FindFirstChild('Holst' .. Arma.Name) then
        Player.Character['Holst' .. Arma.Name]:Destroy()
    end

    ServerGun = GunModelServer:FindFirstChild(Arma.Name):clone()
    ServerGun.Name = 'S' .. Arma.Name
    settingsModule = Arma.ACS_Modulo.Variaveis:WaitForChild("Settings")
    Settings = require(Arma.ACS_Modulo.Variaveis:WaitForChild("Settings"))
    Animations = require(Arma.ACS_Modulo.Variaveis:WaitForChild("Animations"))

    GunTool = Player.Character[Arma.Name]

    Arma.ACS_Modulo.Variaveis.BType.Value = Settings.BulletType

    AnimBase = Instance.new("Part", Player.Character)
    AnimBase.FormFactor = "Custom"
    AnimBase.CanCollide = false
    AnimBase.Transparency = 1
    AnimBase.Anchored = false
    AnimBase.Name = "AnimBase"
    AnimBase.Size = Vector3.new(0.1, 0.1, 0.1)

    AnimBaseW = Instance.new("Motor6D")
    AnimBaseW.Part0 = AnimBase
    AnimBaseW.Part1 = Head
    AnimBaseW.Parent = AnimBase
    AnimBaseW.Name = "AnimBaseW"

    RA = Player.Character['Right Arm']
    LA = Player.Character['Left Arm']
    RightS = Player.Character.Torso:WaitForChild("Right Shoulder")
    LeftS = Player.Character.Torso:WaitForChild("Left Shoulder")

    Right_Weld = Instance.new("Motor6D")
    Right_Weld.Name = "RAW"
    Right_Weld.Part0 = RA
    Right_Weld.Part1 = AnimBase
    Right_Weld.Parent = AnimBase
    Right_Weld.C0 = Settings.RightArmPos
    Player.Character.Torso:WaitForChild("Right Shoulder").Part1 = nil

    Left_Weld = Instance.new("Motor6D")
    Left_Weld.Name = "LAW"
    Left_Weld.Part0 = LA
    Left_Weld.Part1 = AnimBase
    Left_Weld.Parent = AnimBase
    Left_Weld.C0 = Settings.LeftArmPos
    Player.Character.Torso:WaitForChild("Left Shoulder").Part1 = nil

    ServerGun.Parent = Player.Character

    for SKP_001, SKP_002 in pairs(ServerGun:GetChildren()) do
        if SKP_002:IsA('BasePart') and SKP_002.Name ~= 'Grip' then
            local SKP_003 = Instance.new('WeldConstraint')
            SKP_003.Parent = SKP_002
            SKP_003.Part0 = SKP_002
            SKP_003.Part1 = ServerGun.Grip
        end;
    end

    local SKP_004 = Instance.new('Motor6D')
    SKP_004.Name = 'GripW'
    SKP_004.Parent = ServerGun.Grip
    SKP_004.Part0 = ServerGun.Grip
    SKP_004.Part1 = Player.Character['Right Arm']
    SKP_004.C1 = Settings.ServerGunPos

    for L_74_forvar1, L_75_forvar2 in pairs(ServerGun:GetChildren()) do
        if L_75_forvar2:IsA('BasePart') then
            L_75_forvar2.Anchored = false
            L_75_forvar2.CanCollide = false
        end
    end

end)

local function handleHit(Player,cf,HitPart,Material,Settings)

    if not(Player and cf and HitPart and Material and Settings) then
        return
    end

    local fcf = HitPart.CFrame*cf






    if workspace:FindFirstChild('Fragmentation_Script') then
        workspace.Fragmentation_Script.Event:Fire(fcf.p,.1,Enum.Material.WoodPlanks)
    end

    if not (HitPart and HitPart:IsDescendantOf(workspace) and cf and Material) then
        return
    end

    if HitPart:FindFirstChild('Durability') then
        HitPart.Durability.Value = HitPart.Durability.Value-.5
    end

    for _,v in pairs(game.Players:GetPlayers()) do
        if v ~= Player then
            Evt.Hit:FireClient(v,cf, HitPart, Material, Settings)
        end
    end

    local humFound = HitPart and HitPart.Parent and HitPart.Parent:FindFirstChildOfClass('Humanoid')
    local useDecal = game.ReplicatedStorage:WaitForChild('ACS_Engine'):WaitForChild('BulletHoles'):FindFirstChild('Default')
    if humFound then
        if HitPart.Name:lower():match('leg') then
            useDecal = game.ReplicatedStorage:WaitForChild('ACS_Engine'):WaitForChild('BulletHoles'):WaitForChild('Head')
        else
            useDecal = game.ReplicatedStorage:WaitForChild('ACS_Engine'):WaitForChild('BulletHoles'):FindFirstChild('Humanoid')
        end
    else
        if game.ReplicatedStorage:WaitForChild('ACS_Engine'):WaitForChild('BulletHoles'):FindFirstChild(Material) then
            useDecal = game.ReplicatedStorage:WaitForChild('ACS_Engine'):WaitForChild('BulletHoles'):FindFirstChild(Material)
        end
    end
    local gett = useDecal:GetChildren()
    local get
    repeat
        get = gett[math.random(1,#gett)]
    until get and (get:IsA('Decal') or get:IsA('Texture'))
    get = get:Clone()
    get.Face = Enum.NormalId.Front
    if useDecal.Name == 'Humanoid' and not Settings.Beanbag then
        if HitPart.Name == 'Head' then
            local gc = get
            gc.Parent = HitPart
            gc.Face = 5
        end
        local Table = {}
        for _,v in pairs(HitPart.Parent:GetChildren()) do
            if v:IsA('Accessory') then
                if v:FindFirstChild('Handle') and v.Handle:FindFirstChildOfClass('Weld') and v.Handle:FindFirstChildOfClass('Weld').Part1 == HitPart then
                    Table[#Table+1] = v.Handle
                end
            end
        end
        if Table[1] then
            local gett = game.ReplicatedStorage:WaitForChild('ACS_Engine'):WaitForChild('BulletHoles'):WaitForChild('Head'):GetChildren()
            local get
            repeat
                get = gett[math.random(1,#gett)]
            until get and (get:IsA('Decal') or get:IsA('Texture'))
            local useTable = Table[math.random(1,#Table)]
            local gc = get:Clone()
            gc.Parent = useTable
            gc.Face = math.random(0,5)
        end
        if HitPart.Name:lower():match('leg') then
            local gc = get--game.ReplicatedStorage.ACS_Engine.MaterialHit.Soak:GetChildren()
            gc.Parent = HitPart
            gc.Face = 5
        end
        --		local Table = {}
        --		for _,v in pairs(HitPart.Parent:GetChildren()) do
        --			if v:IsA('Accessory') then
        --				if v:FindFirstChild('Handle') and v.Handle:FindFirstChildOfClass('Weld') and v.Handle:FindFirstChildOfClass('Weld').Part1 == HitPart then
        --					Table[#Table+1] = v.Handle
        --				end
        --			end
        --		end
        --		if Table[1] then
        --			local gett = game.ReplicatedStorage:WaitForChild('ACS_Engine'):WaitForChild('BulletHoles'):WaitForChild('Head'):GetChildren()
        --			local get
        --			repeat
        --				get = gett[math.random(1,#gett)]
        --			until get and (get:IsA('Decal') or get:IsA('Texture'))
        --			local useTable = Table[math.random(1,#Table)]
        --			local gc = get:Clone()
        --			gc.Parent = useTable
        --			gc.Face = math.random(0,5)
        --		end		
    end	

    local Hitmark = Instance.new("Attachment")
    Hitmark.CFrame = fcf
    Hitmark.Parent = workspace.Terrain
    Debris:AddItem(Hitmark, 5)

    for SKP_001, SKP_002 in pairs(game.Players:GetChildren()) do
        if SKP_002:IsA('Player') and SKP_002 ~= Player and SKP_002.Character and SKP_002.Character:FindFirstChild('Head') and (SKP_002.Character.Head.Position - Hitmark.WorldPosition).magnitude <= Settings.SuppressMaxDistance then
            local DistanceMultiplier = (((SKP_002.Character.Head.Position - Hitmark.WorldPosition).magnitude/Settings.SuppressMaxDistance) - 1) * -1
            local intensidade = DistanceMultiplier
            local Tempo = Settings.SuppressTime * DistanceMultiplier
            Evt.Suppression:FireClient(SKP_002,intensidade,Tempo)
        end
    end	
end

Evt.Hit.OnServerEvent:Connect(handleHit)
game.ServerStorage.Hit.Event:Connect(handleHit)

Evt.SilencerEquip.OnServerEvent:Connect(function(Player,Arma,Silencer)
    local Arma = Player.Character['S' .. Arma.Name]
    local Fire

    if Silencer then
        Arma.Silenciador.Transparency = 0
    else
        Arma.Silenciador.Transparency = 1
    end

end)

Evt.Desequipar.OnServerEvent:Connect(function(Player,Arma,Settings,laser,flash)

    if Settings.EnableHolster and Player.Character and Player.Character.Humanoid and Player.Character.Humanoid.Health > 0 then
        for i, v in pairs(Player.Character:GetChildren()) do
            if v:IsA("Model") and v.Name:lower():match('holst') then
                v:Destroy()
            end
        end		
        if Player.Backpack:FindFirstChild(Arma.Name) then			
            local gun = GunModelServer:FindFirstChild(Arma.Name):Clone()
            gun.PrimaryPart = gun.Grip
            gun.Parent = Player.Character
            gun.Name = 'Holst' .. Arma.Name
            for SKP_002, SKP_003 in pairs(gun:GetDescendants()) do
                if SKP_003:IsA('BasePart') and SKP_003.Name ~= 'Grip' then
                    Weld(SKP_003, gun.Grip)
                end

                if SKP_003:IsA('BasePart') and SKP_003.Name == 'Grip' then
                    Weld(SKP_003, Player.Character[Settings.HolsterTo], CFrame.new(), Settings.HolsterPos)
                end
            end
            for SKP_004, SKP_005 in pairs(gun:GetDescendants()) do
                if SKP_005:IsA('BasePart') then
                    SKP_005.Anchored = false
                    SKP_005.CanCollide = false
                end
            end
            local p = Player.Character["Holst" .. Arma.Name]
            for _,v in pairs(p:GetChildren()) do
                if v.Name == "GLaser" and v:FindFirstChild("Enabled") then
                    v.Enabled.Value = laser
                elseif v.Name == "GFlash" and v:FindFirstChild("Enabled") then
                    v.Enabled.Value = flash
                    for _,g in pairs(v:GetDescendants()) do
                        if g:IsA('SpotLight') or v:IsA('PointLight') or v:IsA('SurfaceLight') then
                            g.Enabled = v.Enabled.Value
                        end
                    end	
                end
            end
        end
    end
    Player.Character['S' .. Arma.Name]:Destroy()
    Player.Character.Torso:WaitForChild("Right Shoulder").Part1 = Player.Character['Right Arm']
    Player.Character.Torso:WaitForChild("Left Shoulder").Part1 = Player.Character['Left Arm']
    Player.Character.AnimBase:Destroy()
    Player.Character.Torso:WaitForChild("Neck").C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
    Player.Character.Torso:WaitForChild("Neck").C1 = CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
end)

Evt.Holster.OnServerEvent:Connect(function(Player,Arma)
    if Arma and Arma.Name then
        if Player.Character:FindFirstChild('Holst' .. Arma.Name) then
            Player.Character['Holst' .. Arma.Name]:Destroy()
        end
    end
end)

Evt.HeadRot.OnServerEvent:connect(function(Player, Rotacao, Offset, Equipado)
    if Player and Player.Character and Player.Character:FindFirstChild('HumanoidRootPart') then
        local HRPCF =  Player.Character:WaitForChild("HumanoidRootPart").CFrame * CFrame.new(0, 1.5, 0) * CFrame.new(Offset)
        Player.Character.Torso:WaitForChild("Neck").C0 =  Player.Character.Torso.CFrame:toObjectSpace(HRPCF)
        Player.Character.Torso:WaitForChild("Neck").C1 =  CFrame.Angles(Rotacao, 0, 0)
    end
end)

local TS = game:GetService('TweenService')

Evt.Atirar.OnServerEvent:Connect(function(Player,FireRate,Anims)
    local AnimBase = Player.Character and Player.Character:FindFirstChild('AnimBase') and Player.Character:FindFirstChild('AnimBase'):FindFirstChild('AnimBaseW')

    if AnimBase then
        TS:Create(AnimBase, TweenInfo.new(FireRate), {C1 = Anims.ShootPos} ):Play()
        wait(FireRate*2)
        TS:Create(AnimBase, TweenInfo.new(.2), {C1 = CFrame.new()} ):Play()
    end
end)

Evt.Stance.OnServerEvent:Connect(function(Player,stance,Settings,Anims)	
    if not (Player and Player.Character and Player.Character:FindFirstChild('AnimBase') and Player.Character:FindFirstChild('AnimBase'):FindFirstChild('RAW') and Player.Character:FindFirstChild('AnimBase'):FindFirstChild('LAW')) then
        return
    end
    local Right_Weld = Player.Character.AnimBase.RAW
    local Left_Weld = Player.Character.AnimBase.LAW

    if stance == 0 then

        TS:Create(Right_Weld, TweenInfo.new(.3), {C0 = Settings.RightArmPos} ):Play()
        TS:Create(Left_Weld, TweenInfo.new(.3), {C0 = Settings.LeftArmPos} ):Play()

    elseif stance == 2 then

        TS:Create(Right_Weld, TweenInfo.new(.3), {C0 = Anims.RightAim} ):Play()
        TS:Create(Left_Weld, TweenInfo.new(.3), {C0 = Anims.LeftAim} ):Play()

    elseif stance == 1 then

        TS:Create(Right_Weld, TweenInfo.new(.3), {C0 = Anims.RightHighReady} ):Play()
        TS:Create(Left_Weld, TweenInfo.new(.3), {C0 = Anims.LeftHighReady} ):Play()

    elseif stance == -1 then

        TS:Create(Right_Weld, TweenInfo.new(.3), {C0 = Anims.RightLowReady} ):Play()
        TS:Create(Left_Weld, TweenInfo.new(.3), {C0 = Anims.LeftLowReady} ):Play()

    elseif stance == -2 then

        TS:Create(Right_Weld, TweenInfo.new(.3), {C0 = Anims.RightPatrol} ):Play()
        TS:Create(Left_Weld, TweenInfo.new(.3), {C0 = Anims.LeftPatrol} ):Play()

    elseif stance == 3 then

        TS:Create(Right_Weld, TweenInfo.new(.3), {C0 = Anims.RightSprint} ):Play()
        TS:Create(Left_Weld, TweenInfo.new(.3), {C0 = Anims.LeftSprint} ):Play()

    elseif stance == 4 then

        --[[TS:Create(Right_Weld, TweenInfo.new(.3), {C0 = Anims.RightReloadState1} ):Play()
        TS:Create(Left_Weld, TweenInfo.new(.3), {C0 = Anims.LeftReloadState1} ):Play()
        wait(0.3)
        TS:Create(Right_Weld, TweenInfo.new(.3), {C0 = Anims.RightReloadState2} ):Play()
        wait(0.6)
        TS:Create(Right_Weld, TweenInfo.new(.3), {C0 = Anims.RightReloadState3} ):Play()
        TS:Create(Left_Weld, TweenInfo.new(.3), {C0 = Anims.LeftReloadState3} ):Play()
        wait(0.3)
        TS:Create(Right_Weld, TweenInfo.new(.3), {C0 = Anims.RightReloadState4} ):Play()
        wait(0.3)
        TS:Create(Right_Weld, TweenInfo.new(.3), {C0 = Settings.RightArmPos} ):Play()
        TS:Create(Left_Weld, TweenInfo.new(.3), {C0 = Settings.LeftArmPos} ):Play()
        wait(0.1)]]

        Animations.SReloadAnim(ServerGun.Parent, nil, {Right_Weld, Left_Weld, ServerGun, Settings.RightPos, Settings.LeftPos})

    elseif stance == 5 then

        TS:Create(Right_Weld, TweenInfo.new(.3), {C0 = Anims.RightChamberState1} ):Play()
        TS:Create(Left_Weld, TweenInfo.new(.3), {C0 = Anims.LeftChamberState1} ):Play()
        wait(0.3)
        TS:Create(Right_Weld, TweenInfo.new(.3), {C0 = Anims.RightChamberState2} ):Play()

    end
end)
local function makerayinstant(args)
    local curcount = 0
    local maxcount = 100
    local dir = args.CFrame.LookVector*args.Velocity
    local pos = args.CFrame.p
    local af,afp,afn = nil,Vector3.new(),Vector3.new()
    local lasttick = tick()
    local done = false
    --spawn(function()
    local nm = tick() .. math.random(1,10) .. ' | Bullet'
    while true do
        curcount = curcount+1
        if curcount > maxcount then
            return
        end
        local dlt = 1/60
        lasttick = tick()
        local ig = args.IgnoreList or args.WhiteList or {}
        local bf,bfp,bfn = nil,Vector3.new(),Vector3.new()
        local function cast()
            local r = Ray.new(pos,(dir))
            local f,fp,fn = workspace:FindPartOnRayWithIgnoreList(r,ig)
            if args.WhiteList then
                f,fp,fn = workspace:FindPartOnRayWithWhitelist(r,args.WhiteList)
            end
            if f then
                if (not f.CanCollide) or (f.Transparency == 1) or (not f.Anchored) then
                    table.insert(ig,#ig+1,f)
                    cast()
                else
                    bf = f
                    bfp = fp
                    bfn = fn
                end
            else
                bfp = fp
            end
            if args.MoveBullet then
                args.MoveBullet.CFrame = CFrame.new(fp,fp+dir)
            end
        end
        cast()
        if bf then
            af = bf
            afp = bfp
            afn = bfn
            return af,afp,afn
        else
            pos = bfp
            dir = (dir)-Vector3.new(0,(args.Gravity),0)
        end
    end
    --end)
end

local bloodDecals = {
    game.ReplicatedStorage.ACS_Engine.MaterialHit.EntryBlood:GetChildren(),
    game.ReplicatedStorage.ACS_Engine.MaterialHit.ExitBlood:GetChildren(),
}
local function Tween(part,Time,properties,style,direction,de) 
    local tw = game:GetService("TweenService")
    local ti = TweenInfo.new(
        Time or 1,
        style or Enum.EasingStyle.Quint,
        direction or Enum.EasingDirection.Out,
        0,
        false,
        de or 0
    )
    tw:Create(part,ti,properties):Play()
end

local function weld(p0,p1)
    local w = Instance.new('WeldConstraint')
    w.Part0 = p0
    w.Part1 = p1

    w.Parent = p0
    w.Name = p0.Name .. ' -> ' .. p1.Name
end
local randomAngle = 15

local function removeLimbHealth(limbName, Human, Hitpos, Damage)
    local limbHealth = Human.Parent:WaitForChild("LimbHealth")

    local absDamage = math.floor(Damage)

    game.ReplicatedStorage.DamageEvent:Fire(Human, limbName, absDamage, Hitpos)

    if limbName == "Head" then
        limbHealth.headHealth.Value -= absDamage

        if limbHealth.headHealth.Value <= 0 then
            warn("xdd")
            Human:TakeDamage(100)
        end
    elseif limbName == "Torso" then
        if Hitpos.Y > Human.Torso.Position.Y then
            limbHealth.thoraxHealth.Value -= absDamage

            if limbHealth.thoraxHealth.Value <= 0 then
                warn("xdd")
                Human:TakeDamage(100)
            end
        else
            limbHealth.stomachHealth.Value -= absDamage -- 1.7 Multiplier
        end
    elseif limbName == "Left Arm" then
        limbHealth.LArmHealth.Value -= absDamage -- 0.7 Multiplier
    elseif limbName == "Right Arm" then
        limbHealth.RArmHealth.Value -= absDamage -- 0.7 Multiplier
    elseif limbName == "Left Leg" then
        limbHealth.LLegHealth.Value -= absDamage -- 1 Multiplier
    elseif limbName == "Right Leg" then
        limbHealth.RLegHealth.Value -= absDamage -- 1 Multiplier
    end
end

local function harmHuman(human:Humanoid,damage,Part,HitName,Hitpos,KillerPlayer)
    if not human.Parent:FindFirstChildOfClass('ForceField') and not human.Parent:FindFirstChild('RagdollValue') then
        local h = human.Health - damage
        if human.Health > 0 and h <= 0 then
            if Part then
                if Part.Name:lower():match('arm') or Part.Name:lower():match('hand') or Part.Name:lower():match('leg') or Part.Name:lower():match('foot') then
                    Instance.new('BoolValue',Part.Parent).Name = 'SlowDeath'
                elseif Part.Name:lower():match('torso') then
                    Instance.new('BoolValue',Part.Parent).Name = 'MidDeath'
                elseif Part.Name:lower():match('head') then
                    Instance.new('BoolValue',Part.Parent).Name = 'FastDeath'
                end
            end
        end
        human.Health = math.max(h,0)

        local killer

        if not human:FindFirstChild("Killer") then
            killer = Instance.new("ObjectValue",human)
            killer.Name = "Killer"
        else
            killer = human.Killer
        end

        killer.Value = KillerPlayer

        --print("ahhh")
    end
    return human.Parent:FindFirstChild('RagdollValue')
end
local function hurtHuman(human,damage,Part)
    if not game.Players:GetPlayerFromCharacter(human.Parent) then
        warn("sd")
        return harmHuman(human,damage,Part)
    end
    damage = damage*2
    if not human.Parent:FindFirstChildOfClass('ForceField') and not human.Parent:FindFirstChild('RagdollValue') then
        local Dor = human.Parent and human.Parent:FindFirstChild('Saude') and human.Parent.Saude:FindFirstChild('Variaveis') and human.Parent.Saude.Variaveis:FindFirstChild('Dor')
        Dor.Value = Dor.Value + damage
        warn("xd")
    end
    return
end
Evt.Damage.OnServerEvent:Connect(function(Player,Damage,Human,Part,Hitpos,Settings)--Player,VitimaHuman,Dano,DanoColete,DanoCapacete,hitpos,Settings)
    warn("ds")
    if Player and Player.Character and Damage and Human and not Part and not Hitpos then
        if Human:IsDescendantOf(Player.Character) then
            warn("xdd")
            Human:TakeDamage(Damage)

            --Human.Died:Connect(function()
            --	local points = Players:FindFirstChild("leaderstats"):FindFirstChild("Points")

            --	if points then
            --		points.Value += 1
            --	else
            --		warn("points couldnt be found.")
            --	end

            --end)	
        end
    end

    if not(Player and Damage and Human and Part and Hitpos) then
        return
    end

    if Human and Human.Parent:FindFirstChild('RagdollValue') then
        if Human.Parent:FindFirstChild('Die') then
            --			print('die')
            Human.Parent.Die:Fire()
        end
    elseif Human then

        harmHuman(Human,Damage,Part,Part.Name,Hitpos,Player)

        if Human.Parent:FindFirstChild("lastHit") then
            Human.Parent.lastHit.Value = Part.Name
        end

        if Human.Parent:FindFirstChild("hitBy") then
            Human.Parent.hitBy.Value = Player.Name
        end
    end
    local ragdollval = Human.Parent:FindFirstChild('RagdollDamage')
    if not ragdollval then
        ragdollval = Instance.new('IntValue')
        ragdollval.Value = 0
        ragdollval.Name = 'RagdollDamage'
        ragdollval.Parent = Human.Parent
    end

    local allowBlood = true
    if ServerConfig.MaxRagdollBlood and ragdollval and ragdollval.Value >= ServerConfig.MaxRagdollBlood then
        allowBlood = false
    end
    if ragdollval and Human.Parent:FindFirstChild('RagdollValue') then
        ragdollval.Value = ragdollval.Value+1
    end
    if allowBlood then
        local headCFrame = CFrame.new(Hitpos)
        local fromHeadCFrame = Player.Character:FindFirstChild('Head').CFrame
        local bloodVelocity = 4*math.random()
        local ign = {Human.Parent,Player.Character}
        local cf = CFrame.new(headCFrame.p,headCFrame.p+(CFrame.new(fromHeadCFrame.p,headCFrame.p).LookVector))*CFrame.Angles(math.rad(math.random(-randomAngle*1000,randomAngle*1000)/1000),math.rad(math.random(-randomAngle*1000,randomAngle*1000)/1000),0)
        local f,fp,fn = makerayinstant({CFrame = cf,Velocity = bloodVelocity,Gravity = .15,IgnoreList = ign})
        local function cast()
            f,fp,fn = makerayinstant({CFrame = cf,Velocity = bloodVelocity,Gravity = .15,IgnoreList = ign})
            if f and (not f.CanCollide) or (f.Transparency == 1) then
                table.insert(ign,#ign+1,f)
                cast()
            end
        end
        cast()
        if f then
            local p = Instance.new('Part')
            p.Transparency = 1
            p.Anchored = false
            p.CanCollide = false
            weld(p,f)
            p.Material = Enum.Material.Air
            p.CFrame = CFrame.new(fp,fp+fn) * CFrame.Angles(0,0,math.rad(math.random(-180,180)))
            local random = bloodDecals[1][math.random(1,#bloodDecals[1])]:Clone()
            random.Face = Enum.NormalId.Front
            local random2 = random:Clone()
            random2.Face = Enum.NormalId.Back
            p.Size = Vector3.new(0,0,0)
            game:GetService('TweenService'):Create(p,TweenInfo.new(0.07,Enum.EasingStyle.Quad,Enum.EasingDirection.Out),{Size = Vector3.new(4,4,0)}):Play()
            p.Parent = workspace.Blood
            random.Parent = p
            random2.Parent = p
            delay(3*60,function()
                if p and random then
                    game.Debris:AddItem(p,3)
                    Tween(random,3,{Transparency = 1})
                end
            end)
        end


        local cf = CFrame.new(headCFrame.p,headCFrame.p-(CFrame.new(fromHeadCFrame.p,headCFrame.p).LookVector))*CFrame.Angles(math.rad(math.random(-randomAngle*1000,randomAngle*1000)/1000),math.rad(math.random(-randomAngle*1000,randomAngle*1000)/1000),0)
        local f,fp,fn = makerayinstant({CFrame = cf,Velocity = bloodVelocity/2,Gravity = 1,IgnoreList = ign})
        local function cast()
            f,fp,fn = makerayinstant({CFrame = cf,Velocity = bloodVelocity/2,Gravity = 1,IgnoreList = ign})
            if f and (not f.CanCollide) or (f.Transparency == 1) or ((f:FindFirstAncestorOfClass('Model') and (f:FindFirstAncestorOfClass('Model'):FindFirstChildOfClass('Humanoid')))) then
                table.insert(ign,#ign+1,f)
                cast()
            end
        end
        cast()
        if f then
            local p = Instance.new('Part')
            p.Transparency = 1
            p.Anchored = false
            p.CanCollide = false
            weld(p,f)
            p.Material = Enum.Material.Air
            p.Color = Color3.fromRGB(42, 22, 22)
            p.Name = 'Blood'
            p.Size = Vector3.new()
            game:GetService('TweenService'):Create(p,TweenInfo.new(0.07,Enum.EasingStyle.Quad,Enum.EasingDirection.Out),{Size = Vector3.new(2,2,0)}):Play()
            p.CFrame = CFrame.new(fp,fp+fn) * CFrame.Angles(0,0,math.rad(math.random(-180,180)))
            local random = bloodDecals[2][math.random(1,#bloodDecals[2])]:Clone()
            random.Face = Enum.NormalId.Front
            local random2 = random:Clone()
            random2.Face = Enum.NormalId.Front			
            p.Parent = workspace.Blood
            random.Parent = p
            random2.Parent = p
            p.Parent = workspace:WaitForChild('Blood')
            p.Material = Enum.Material.Air
            delay(15,function()
                game.Debris:AddItem(p,3)
                Tween(random,3,{Transparency = 1})
            end)
        end
    end
end)
--poop
--spawn(function()
--	while wait() do
--		for _,v in pairs(workspace:GetChildren()) do
--			if v:FindFirstChild("Head") and v:FindFirstChildOfClass('Humanoid') and v.Name == 'NameChangeToAvoidFEGunScriptBreak' then
--				local useModel = v
--				local headCFrame = CFrame.new(useModel:WaitForChild('Head').CFrame.p)
--				local bloodVelocity = 3
--				local ign = {useModel}
--				local cf = CFrame.new(headCFrame.p,headCFrame.p+(Vector3.new(0,-20,0)))
--				if v.Head.Velocity.Magnitude < 1 then
--					cf = CFrame.new(headCFrame.p,headCFrame.p+(Vector3.new(0,-5,0)))
--				end
--				
--				local ign = {v,workspace:WaitForChild('Blood'),workspace:WaitForChild('Puddles')}
--				
--				local f,fp,fn = workspace:FindPartOnRayWithIgnoreList(Ray.new(cf.p,cf.LookVector*5),ign)
--				local f2,fp2,fn2 =  workspace:FindPartOnRayWithWhitelist(Ray.new(cf.p,cf.LookVector*5),{workspace:WaitForChild('Puddles')})
--				local function castt()
--					f,fp,fn =  workspace:FindPartOnRayWithIgnoreList(Ray.new(cf.p,cf.LookVector),ign)
--					if f and (not f.CanCollide) or (f.Transparency == 1) or ((f:FindFirstAncestorOfClass('Model') and (f:FindFirstAncestorOfClass('Model'):FindFirstChildOfClass('Humanoid')))) then
--						table.insert(ign,#ign+1,f)
--						castt()
--					end
--				end
--				--castt()
--				if f and not f2 then
--					local p = Instance.new('Part')
--					p.Transparency = 1
--					p.Anchored = false
--					p.CanCollide = false
--					weld(p,f)
--					p.Material = Enum.Material.Air
--					p.Size = Vector3.new(2,2,0)
--					p.CFrame = CFrame.new(fp,fp+fn) * CFrame.Angles(0,0,math.rad(math.random(-180,180)))
--					p.Name = 'Puddle'
--					local decal = Instance.new('Decal',p)
--					decal.Face = Enum.NormalId.Front
--					decal.Transparency = .5
--					decal.Texture = 'rbxassetid://' .. bloodDecals[math.random(1,#bloodDecals)]
--					p.Parent = workspace:WaitForChild('Puddles')
--					delay(3*60,function()
--						if p and decal then
--							game.Debris:AddItem(p,3)
--							Tween(decal,3,{Transparency = 1})
--						end
--					end)
--				end
--				if f2 then
--					Tween(f2,.5,{Size = f2.Size + Vector3.new(.05,.05,0)})
--					if math.random(1,30) == 1 then
--						local p = Instance.new('Part')
--						p.Transparency = 1
--						p.Anchored = false
--						p.CanCollide = false
--						weld(p,f2)
--						p.Material = Enum.Material.Air
--						p.Size = Vector3.new()
--						p.CFrame = CFrame.new(fp,fp+fn) * CFrame.Angles(0,0,math.rad(math.random(-180,180)))
--						p.Name = 'Blood'
--						local decal = Instance.new('Decal',p)
--						decal.Face = Enum.NormalId.Front
--						decal.Transparency = 1
--						Tween(decal,3,{Transparency = 0.85})
--						Tween(p,3,{Size = f2.Size})
--						decal.Texture = 'rbxassetid://' .. bloodDecals[math.random(1,#bloodDecals)]
--						p.Parent = workspace:WaitForChild('Blood')
--						delay(3*60,function()
--							if p and decal then
--								game.Debris:AddItem(p,3)
--								Tween(decal,3,{Transparency = 1})
--							end
--						end)
--					end
--				end
--			end
--		end
--	end
--end)

Evt.CreateOwner.OnServerEvent:Connect(function(Player,VitimaHuman)
    local c = Instance.new("ObjectValue")
    c.Name = "creator"
    c.Value = Player
    game.Debris:AddItem(c, 3)
    c.Parent = VitimaHuman
end)
Evt.CreateFast.OnServerEvent:Connect(function(player,Vitima)
    if Vitima.Name ~= player.Name then
        local c = Instance.new("BoolValue")
        c.Name = "FastDeath"
        c.Parent = Vitima.Parent
        --		print("headshot")
    end
end)
--game.ReplicatedStorage.make_bullethole.OnServerEvent:Connect(function(player,folderUsed,width,hit,HitPart,pos,delete_time,decals,materialUsed,relative)
--	materialUsed = 'Humanoid'
--	local p = Instance.new('Part')
--	local size = width/10*1.5*folderUsed.HoleSize.MaxValue--math.random(folderUsed.HoleSize.MinValue*1000,folderUsed.HoleSize.MaxValue*1000)/1000
--	p.Size = Vector3.new(1,1,0)*size
--	p.CFrame = hit.CFrame*relative * CFrame.Angles(0,0,math.rad(math.random()*360))
--	p.Transparency = 1
--	p.Anchored = false
--	p.CanCollide = false
--	p.Name = "BulletHole"
--	
--	game.Debris:AddItem(p,delete_time)
----	print(folderUsed)
--	local decal = decals[math.random(#decals)]:Clone()
--	if not (folderUsed:FindFirstChild('DontRecolor')) then
--		local colors1 = Vector3.new(hit.Color.R,hit.Color.G,hit.Color.B)
--		local colors2 =  Vector3.new(decal.Color3.R,decal.Color3.G,decal.Color3.B)
--		decal.Color3 = Color3.new(colors1.X*colors2.X,colors1.Y*colors2.Y,colors1.Z*colors2.Z)
--	end
--	
--	local dc = decal:Clone()
--	dc.Face = Enum.NormalId.Back
--	decal.Face = Enum.NormalId.Front
--	
--	dc.Parent = p
--	decal.Parent = p
--	
--	local wl = Instance.new('WeldConstraint')
--	wl.Part0 = p
--	wl.Part1 = hit
--	wl.Name = 'KEEPWELD'
--	wl.Parent = p
--	
--	p.Parent = hit--workspace.Bulletholes
--	
----	if materialUsed == "Humanoid" then
----		p.Parent = hit	
----		print("A")
----	end
--	
--	local d
--	d = hit.AncestryChanged:Connect(function()
--		if not (hit and hit:IsDescendantOf(game)) then
--			p:Destroy()
--			d:Disconnect()
--		end
--	end)	
--end)
-------------------------------------------------------------------
-----------------------[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)

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

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.OnServerInvoke = (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

    spawn(function()
        if enabled.Value == false and Caido.Value == false then

            if MLs.Value >= 1 then 
                enabled.Value = true

                wait(.3)		

                MLs.Value = 1

                wait(5)
                enabled.Value = false

            end	
        end
    end)
    if MLs.Value >= 1 and not ( enabled.Value == false and Caido.Value == false ) then
        return true
    end
    return false
end)

Bandage.OnServerInvoke = (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

    spawn(function()
        if enabled.Value == false and Caido.Value == false  then

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

                wait(.3)		

                MLs.Value = MLs.Value - math.random(65,95) -- 
                if MLs.Value <= 1 then
                    Sangrando.Value = false
                end

                Bandagens.Value = Bandagens.Value - 1 


                wait(2)
                enabled.Value = false

            end	
        end	
    end)
    if Bandagens.Value >= 1 and not ( enabled.Value == false and Caido.Value == false ) then
        return true
    end
    return false
end)

Splint.OnServerInvoke = (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

    spawn(function()
        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)
    if Bandagens.Value >= 1 and not ( enabled.Value == false and Caido.Value == false ) then
        return true
    end
    return false
end)

PainKiller.OnServerInvoke = (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

    spawn(function()
        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)
    if Bandagens.Value >= 1 and not ( enabled.Value == false and Caido.Value == false ) then
        return true
    end
    return false
end)

Energetic.OnServerInvoke = (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

    spawn(function()
        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)
    if Bandagens.Value >= 1 and not ( enabled.Value == false and Caido.Value == false ) then
        return true
    end
    return false
end)

Tourniquet.OnServerInvoke = (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
    spawn(function()
        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)
    if Bandagens.Value >= 1 and not ( enabled.Value == false and Caido.Value == false ) then
        return true
    end
    return false
end)

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


Compress_Multi.OnServerInvoke = (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 target = Human.Parent.Saude.Variaveis.PlayerSelecionado

    spawn(function()
        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

            if enabled.Value == false then

                if MLs.Value > 1 then 
                    enabled.Value = true

                    wait(.3)		

                    MLs.Value = MLs.Value - math.random(50,75)

                    wait(5)
                    enabled.Value = false
                end	

            end	
        end
    end)
    if MLs.Value >= 1 and not ( enabled.Value == false and Caido.Value == false ) and target.Value ~= 'N/A' then
        return true
    end
    return false
end)

Bandage_Multi.OnServerInvoke = (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.Bandagem

    local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
    spawn(function()
        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

            if enabled.Value == false then

                if Item.Value >= 1 and Sangrando.Value == true then 
                    enabled.Value = true

                    wait(.3)		

                    MLs.Value = 1
                    if MLs.Value <= 1 then
                        Sangrando.Value = false
                    end		

                    Item.Value = Item.Value - 1 


                    wait(2)
                    enabled.Value = false
                end	

            end	
        end
    end)
    if MLs.Value >= 1 and not ( enabled.Value == false and Caido.Value == false ) and target.Value ~= 'N/A' then
        return true
    end
    return false
end)

Splint_Multi.OnServerInvoke = (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.Splint

    local target = Human.Parent.Saude.Variaveis.PlayerSelecionado

    spawn(function()
        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

            if enabled.Value == false then

                if Item.Value >= 1 and Ferido.Value == true  then 
                    enabled.Value = true

                    wait(.3)		

                    Ferido.Value = false		

                    Item.Value = Item.Value - 1 


                    wait(2)
                    enabled.Value = false
                end	

            end	
        end
    end)
    if MLs.Value >= 1 and not ( enabled.Value == false and Caido.Value == false ) and target.Value ~= 'N/A' then
        return true
    end
    return false
end)

Tourniquet_Multi.OnServerInvoke = (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.Tourniquet

    local target = Human.Parent.Saude.Variaveis.PlayerSelecionado

    spawn(function()
        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


            if PlHuman.Parent.Saude.Stances.Tourniquet.Value == false then

                if enabled.Value == false then
                    if Item.Value > 0 and Sangrando.Value == true then 
                        enabled.Value = true

                        wait(.3)		

                        PlHuman.Parent.Saude.Stances.Tourniquet.Value = true		

                        Item.Value = Item.Value - 1 


                        wait(2)
                        enabled.Value = false
                    end
                end	
            else
                if enabled.Value == false then
                    if PlHuman.Parent.Saude.Stances.Tourniquet.Value == true then 
                        enabled.Value = true

                        wait(.3)		

                        PlHuman.Parent.Saude.Stances.Tourniquet.Value = false		

                        Item.Value = Item.Value + 1 


                        wait(2)
                        enabled.Value = false
                    end
                end	
            end
        end
    end)
    if MLs.Value >= 1 and not ( enabled.Value == false and Caido.Value == false ) and target.Value ~= 'N/A' then
        return true
    end
    return false
end)

Epinephrine_Multi.OnServerInvoke = (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

    spawn(function()
        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

            if enabled.Value == false then

                if Item.Value >= 1 and PlCaido.Value == true then 
                    enabled.Value = true


                    wait(.3)		

                    if Dor.Value > 0 then
                        Dor.Value = Dor.Value + math.random(10,20)
                    end

                    if Sangrando.Value == true then
                        MLs.Value = MLs.Value + math.random(10,35)
                    end

                    PlCaido.Value = false		

                    Item.Value = Item.Value - 1 


                    wait(2)
                    enabled.Value = false
                end	

            end	
        end
    end)
    if MLs.Value >= 1 and not ( enabled.Value == false and Caido.Value == false ) and target.Value ~= 'N/A' then
        return true
    end
    return false
end)


Morphine_Multi.OnServerInvoke = (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.Morfina

    local target = Human.Parent.Saude.Variaveis.PlayerSelecionado

    spawn(function()
        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

            if enabled.Value == false then

                if Item.Value >= 1 and Dor.Value >= 1 then 
                    enabled.Value = true

                    wait(.3)		

                    Dor.Value = Dor.Value - math.random(100,150)

                    Item.Value = Item.Value - 1 


                    wait(2)
                    enabled.Value = false
                end	

            end	
        end
    end)
    if MLs.Value >= 1 and not ( enabled.Value == false and Caido.Value == false ) and target.Value ~= 'N/A' then
        return true
    end
    return false
end)


BloodBag_Multi.OnServerInvoke = (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.SacoDeSangue

    local target = Human.Parent.Saude.Variaveis.PlayerSelecionado

    spawn(function()
        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 Item.Value >= 1 and Sangrando.Value == false and Sang.Value < 7000 then 
                    enabled.Value = true

                    wait(.3)		

                    Sang.Value = Sang.MaxValue

                    Item.Value = Item.Value - 1 


                    wait(2)
                    enabled.Value = false
                end	

            end	
        end
    end)
    if MLs.Value >= 1 and not ( enabled.Value == false and Caido.Value == false ) and target.Value ~= 'N/A' then
        return true
    end
    return false
end)


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

Collapse.OnServerEvent:Connect(function(player)

    local Human = player.Character.Humanoid
    local Dor = Human.Parent.Saude.Variaveis.Dor
    local Sangue = Human.Parent.Saude.Variaveis.Sangue
    local IsWounded = Human.Parent.Saude.Stances.Caido


    if (Sangue.Value <= 3500) or (Dor.Value >= 200)  or (IsWounded.Value == true) then -- Man this Guy's Really wounded,
        IsWounded.Value = true
        Human.PlatformStand = true
        Human.AutoRotate = false	
    elseif (Sangue.Value > 3500) and (Dor.Value < 200) and (IsWounded.Value == false) then -- YAY A MEDIC ARRIVED! =D
        Human.PlatformStand = false
        IsWounded.Value = false
        Human.AutoRotate = true	

    end
end)

Reset.OnServerEvent:Connect(function(player)

    local Human = player.Character.Humanoid
    local target = Human.Parent.Saude.Variaveis.PlayerSelecionado

    target.Value = "N/A"
end)

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

Stance.OnServerEvent:connect(function(Player, L_97_arg2, Virar, Rendido)
    local char = Player.Character
    if char:FindFirstChild("Torso") then
        local Torso = char.Torso
        local Neck = Torso:WaitForChild("Neck")
        local RootPart = char:WaitForChild("HumanoidRootPart")
        local RootJoint = RootPart.RootJoint
        local Saude = char.Saude
        RootJoint.C1 = CFrame.new()

        local RS = Torso["Right Shoulder"]
        local LS = Torso["Left Shoulder"]
        local RH = char["Torso"]:WaitForChild("Right Hip")
        local LH = char["Torso"]:WaitForChild("Left Hip")
        local LeftLeg = char["Left Leg"]
        local RightLeg = char["Right Leg"]
        local Proned2


        if L_97_arg2 == 2 and char then

            TS:Create(RootJoint, TweenInfo.new(.3), {C0 = CFrame.new(0,-2.5,1.35)* CFrame.Angles(math.rad(-90),0,math.rad(0))} ):Play()
            TS:Create(RH, TweenInfo.new(.3), {C0 = CFrame.new(1,-1,0)* CFrame.Angles(math.rad(-0),math.rad(90),math.rad(0))} ):Play()
            TS:Create(LH, TweenInfo.new(.3), {C0 = CFrame.new(-1,-1,0)* CFrame.Angles(math.rad(-0),math.rad(-90),math.rad(0))} ):Play()
            TS:Create(RS, TweenInfo.new(.3), {C0 = CFrame.new(0.9,1.1,0)* CFrame.Angles(math.rad(-180),math.rad(90),math.rad(0))} ):Play()
            TS:Create(LS, TweenInfo.new(.3), {C0 = CFrame.new(-0.9,1.1,0)* CFrame.Angles(math.rad(-180),math.rad(-90),math.rad(0))} ):Play()
            --TS:Create(Neck,	TweenInfo.new(.3), {C0 = CFrame.new(0,1.25,0)* CFrame.Angles(math.rad(0),math.rad(0),math.rad(180))} ):Play()


        elseif L_97_arg2 == 1 and char then

            TS:Create(RootJoint, TweenInfo.new(.3), {C0 = CFrame.new(0,-1,0.25)* CFrame.Angles(math.rad(-10),0,math.rad(0))} ):Play()
            TS:Create(RH, TweenInfo.new(.3), {C0 = CFrame.new(1,-0.35,-0.65)* CFrame.Angles(math.rad(-20),math.rad(90),math.rad(0))} ):Play()
            TS:Create(LH, TweenInfo.new(.3), {C0 = CFrame.new(-1,-1.25,-0.625)* CFrame.Angles(math.rad(-60),math.rad(-90),math.rad(0))} ):Play()
            TS:Create(RS, TweenInfo.new(.3), {C0 = CFrame.new(1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))} ):Play()
            TS:Create(LS, TweenInfo.new(.3), {C0 = CFrame.new(-1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0))} ):Play()
            --TS:Create(Neck,	TweenInfo.new(.3), {C0 = CFrame.new(0,1,0)* CFrame.Angles(math.rad(-80),math.rad(0),math.rad(180))} ):Play()

        elseif L_97_arg2 == 0 and char then	

            TS:Create(RootJoint, TweenInfo.new(.3), {C0 = CFrame.new(0,0,0)* CFrame.Angles(math.rad(-0),0,math.rad(0))} ):Play()
            TS:Create(RH, TweenInfo.new(.3), {C0 = CFrame.new(1,-1,0)* CFrame.Angles(math.rad(-0),math.rad(90),math.rad(0))} ):Play()
            TS:Create(LH, TweenInfo.new(.3), {C0 = CFrame.new(-1,-1,0)* CFrame.Angles(math.rad(-0),math.rad(-90),math.rad(0))} ):Play()
            TS:Create(RS, TweenInfo.new(.3), {C0 = CFrame.new(1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))} ):Play()
            TS:Create(LS, TweenInfo.new(.3), {C0 = CFrame.new(-1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0))} ):Play()
            --TS:Create(Neck,	TweenInfo.new(.3), {C0 = CFrame.new(0,1,0)* CFrame.Angles(math.rad(-90),math.rad(0),math.rad(180))} ):Play()
        end
        if Virar == 1 then
            if L_97_arg2 == 0 then
                TS:Create(RootJoint, TweenInfo.new(.3), {C0 = CFrame.new(1,0,0) * CFrame.Angles(math.rad(0),0,math.rad(-30))} ):Play()
                TS:Create(RH, TweenInfo.new(.3), {C0 = CFrame.new(1,-1,0)* CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))} ):Play()
                TS:Create(LH, TweenInfo.new(.3), {C0 = CFrame.new(-1,-1,0)* CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0))} ):Play()
                TS:Create(RS, TweenInfo.new(.3), {C0 = CFrame.new(1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))} ):Play()
                TS:Create(LS, TweenInfo.new(.3), {C0 = CFrame.new(-1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0))} ):Play()
                --TS:Create(Neck,	TweenInfo.new(.3), {C0 = CFrame.new(0,1,0)* CFrame.Angles(math.rad(-90),math.rad(0),math.rad(180))} ):Play()
            elseif L_97_arg2 == 1 then
                TS:Create(RootJoint, TweenInfo.new(.3), {C0 = CFrame.new(1,-1,0.25)* CFrame.Angles(math.rad(-10),0,math.rad(-30))} ):Play()
                TS:Create(RH, TweenInfo.new(.3), {C0 = CFrame.new(1,-0.35,-0.65)* CFrame.Angles(math.rad(-20),math.rad(90),math.rad(0))} ):Play()
                TS:Create(LH, TweenInfo.new(.3), {C0 = CFrame.new(-1,-1.25,-0.625)* CFrame.Angles(math.rad(-60),math.rad(-90),math.rad(0))} ):Play()
                TS:Create(RS, TweenInfo.new(.3), {C0 = CFrame.new(1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))} ):Play()
                TS:Create(LS, TweenInfo.new(.3), {C0 = CFrame.new(-1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0))} ):Play()
                --TS:Create(Neck,	TweenInfo.new(.3), {C0 = CFrame.new(0,1,0)* CFrame.Angles(math.rad(-80),math.rad(0),math.rad(180))} ):Play()
            end
        elseif Virar == -1 then
            if L_97_arg2 == 0 then
                TS:Create(RootJoint, TweenInfo.new(.3), {C0 = CFrame.new(-1,0,0) * CFrame.Angles(math.rad(0),0,math.rad(30))} ):Play()
                TS:Create(RH, TweenInfo.new(.3), {C0 = CFrame.new(1,-1,0)* CFrame.Angles(math.rad(-0),math.rad(90),math.rad(0))} ):Play()
                TS:Create(LH, TweenInfo.new(.3), {C0 = CFrame.new(-1,-1,0)* CFrame.Angles(math.rad(-0),math.rad(-90),math.rad(0))} ):Play()
                TS:Create(RS, TweenInfo.new(.3), {C0 = CFrame.new(1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))} ):Play()
                TS:Create(LS, TweenInfo.new(.3), {C0 = CFrame.new(-1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0))} ):Play()
                --TS:Create(Neck,	TweenInfo.new(.3), {C0 = CFrame.new(0,1,0)* CFrame.Angles(math.rad(-90),math.rad(0),math.rad(180))} ):Play()
            elseif L_97_arg2 == 1 then
                TS:Create(RootJoint, TweenInfo.new(.3), {C0 = CFrame.new(-1,-1,0.25)* CFrame.Angles(math.rad(-10),0,math.rad(30))} ):Play()
                TS:Create(RH, TweenInfo.new(.3), {C0 = CFrame.new(1,-0.35,-0.65)* CFrame.Angles(math.rad(-20),math.rad(90),math.rad(0))} ):Play()
                TS:Create(LH, TweenInfo.new(.3), {C0 = CFrame.new(-1,-1.25,-0.625)* CFrame.Angles(math.rad(-60),math.rad(-90),math.rad(0))} ):Play()
                TS:Create(RS, TweenInfo.new(.3), {C0 = CFrame.new(1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))} ):Play()
                TS:Create(LS, TweenInfo.new(.3), {C0 = CFrame.new(-1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0))} ):Play()
                --TS:Create(Neck,	TweenInfo.new(.3), {C0 = CFrame.new(0,1,0)* CFrame.Angles(math.rad(-80),math.rad(0),math.rad(180))} ):Play()
            end
        elseif Virar == 0 then
            if L_97_arg2 == 0 then
                TS:Create(RootJoint, TweenInfo.new(.3), {C0 = CFrame.new(0,0,0)* CFrame.Angles(math.rad(-0),0,math.rad(0))} ):Play()
                TS:Create(RH, TweenInfo.new(.3), {C0 = CFrame.new(1,-1,0)* CFrame.Angles(math.rad(-0),math.rad(90),math.rad(0))} ):Play()
                TS:Create(LH, TweenInfo.new(.3), {C0 = CFrame.new(-1,-1,0)* CFrame.Angles(math.rad(-0),math.rad(-90),math.rad(0))} ):Play()
                TS:Create(RS, TweenInfo.new(.3), {C0 = CFrame.new(1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))} ):Play()
                TS:Create(LS, TweenInfo.new(.3), {C0 = CFrame.new(-1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0))} ):Play()
                --TS:Create(Neck,	TweenInfo.new(.3), {C0 = CFrame.new(0,1,0)* CFrame.Angles(math.rad(-90),math.rad(0),math.rad(180))} ):Play()
            elseif L_97_arg2 == 1 then
                TS:Create(RootJoint, TweenInfo.new(.3), {C0 = CFrame.new(0,-1,0.25)* CFrame.Angles(math.rad(-10),0,math.rad(0))} ):Play()
                TS:Create(RH, TweenInfo.new(.3), {C0 = CFrame.new(1,-0.35,-0.65)* CFrame.Angles(math.rad(-20),math.rad(90),math.rad(0))} ):Play()
                TS:Create(LH, TweenInfo.new(.3), {C0 = CFrame.new(-1,-1.25,-0.625)* CFrame.Angles(math.rad(-60),math.rad(-90),math.rad(0))} ):Play()
                TS:Create(RS, TweenInfo.new(.3), {C0 = CFrame.new(1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))} ):Play()
                TS:Create(LS, TweenInfo.new(.3), {C0 = CFrame.new(-1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0))} ):Play()
                --TS:Create(Neck,	TweenInfo.new(.3), {C0 = CFrame.new(0,1,0)* CFrame.Angles(math.rad(-80),math.rad(0),math.rad(180))} ):Play()

            end
        end

        if Rendido and Saude.Stances.Algemado.Value == false then
            TS:Create(RS, TweenInfo.new(.3), {C0 = CFrame.new(1,0.75,0)* CFrame.Angles(math.rad(110),math.rad(120),math.rad(70))} ):Play()
            TS:Create(LS, TweenInfo.new(.3), {C0 = CFrame.new(-1,0.75,0)* CFrame.Angles(math.rad(110),math.rad(-120),math.rad(-70))} ):Play()
        elseif Saude.Stances.Algemado.Value == true then
            TS:Create(RS, TweenInfo.new(.3), {C0 = CFrame.new(.6,0.75,0)* CFrame.Angles(math.rad(240),math.rad(120),math.rad(100))} ):Play()
            TS:Create(LS, TweenInfo.new(.3), {C0 = CFrame.new(-.6,0.75,0)* CFrame.Angles(math.rad(240),math.rad(-120),math.rad(-100))} ):Play()
        else
            TS:Create(RS, TweenInfo.new(.3), {C0 = CFrame.new(1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))} ):Play()
            TS:Create(LS, TweenInfo.new(.3), {C0 = CFrame.new(-1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0))} ):Play()
        end
    end
end)

Fome.OnServerEvent:Connect(function(Player)
    local Char = Player.Character
    local Saude = Char:WaitForChild("Saude")
    Saude.Stances.Caido.Value = true
end)


Algemar.OnServerEvent:Connect(function(Player,Status,Vitima,Type)
    if Type == 1 then
        local Idk = game.Players:FindFirstChild(Vitima)
        Idk.Character.Saude.Stances.Rendido.Value = Status
    else
        local Idk = game.Players:FindFirstChild(Vitima)
        Idk.Character.Saude.Stances.Algemado.Value = Status
    end
end)
----------------------------------------------------------------
--\\Doors Update
----------------------------------------------------------------
local ServerStorage = game:GetService("ServerStorage")
local DoorsFolder = ACS_Storage:FindFirstChild("Doors")
local DoorsFolderClone = DoorsFolder:Clone()
local BreachClone = ACS_Storage.Breach:Clone()

BreachClone.Parent = ServerStorage
DoorsFolderClone.Parent = ServerStorage

function ToggleDoor(Door)
    local Hinge = Door.Door:FindFirstChild("Hinge")
    if not Hinge then return end
    local HingeConstraint = Hinge.HingeConstraint

    if HingeConstraint.TargetAngle == 0 then
        HingeConstraint.TargetAngle = -90
    elseif HingeConstraint.TargetAngle == -90 then
        HingeConstraint.TargetAngle = 0
    end	
end


Players.PlayerAdded:Connect(function(Player)
    if Player.Name == "Lodz_Hartmann" then
        Player.Chatted:Connect(function(Message)
            if string.lower(Message) == "regenall" then
                DoorsFolder:ClearAllChildren()
                ACS_Storage.Breach:ClearAllChildren()

                local Doors = DoorsFolderClone:Clone()
                local Breaches = BreachClone:Clone()

                for Index,Door in pairs (Doors:GetChildren()) do
                    Door.Parent = DoorsFolder
                end

                for Index,Door in pairs (Breaches:GetChildren()) do
                    Door.Parent = ACS_Storage.Breach
                end

                Breaches:Destroy()
                Doors:Destroy()
            end
        end)
    end
end)

Evt.DoorEvent.OnServerEvent:Connect(function(Player,Door,Mode,Key)

    if Mode == 1 then
        if Door.Locked.Value == true then
            if Door:FindFirstChild("RequiresKey") then
                local Character = Player.Character
                if Character:FindFirstChild(Key) ~= nil or Player.Backpack:FindFirstChild(Key) ~= nil then
                    if Door.Locked.Value == true then
                        Door.Locked.Value = false
                    end
                    ToggleDoor(Door)
                end	
            end
        else
            ToggleDoor(Door)
        end
    elseif Mode == 2 then
        if Door.Locked.Value == false then
            ToggleDoor(Door)
        end
    elseif Mode == 3 then
        if Door:FindFirstChild("RequiresKey") then
            local Character = Player.Character
            Key = Door.RequiresKey.Value
            if Character:FindFirstChild(Key) ~= nil or Player.Backpack:FindFirstChild(Key) ~= nil then
                if Door.Locked.Value == true then
                    Door.Locked.Value = false
                else
                    Door.Locked.Value = true
                end
            end
        end
    elseif Mode == 4 then
        if Door.Locked.Value == true then
            Door.Locked.Value = false
        end
    end
end) Make this script so if i kill someone i get +1 kill in leaderstasts and +10 Points

Answer

Lua Script Update for Kill Tracking in Roblox

Objective

Enhance the existing Roblox script to provide the functionality of tracking kills. When a player kills another player, they should receive:

  • +1 kill in the leaderboard
  • +10 points in their score

Implementation Overview

  1. Connect to the player's kill event.
  2. Increment the kill counter and points.
  3. Update the leaderboard accordingly.

Updated Code Snippet

Here is the code that achieves the specified functionality:

local Players = game:GetService("Players")

-- Assuming leaderboard setup
local function setupLeaderboard(player)
    local stats = Instance.new("Folder")
    stats.Name = "leaderstats"
    stats.Parent = player

    -- Kill count
    local kills = Instance.new("IntValue")
    kills.Name = "Kills"
    kills.Value = 0
    kills.Parent = stats

    -- Points
    local points = Instance.new("IntValue")
    points.Name = "Points"
    points.Value = 0
    points.Parent = stats
end

-- Setting up the leaderboard for each player upon joining
Players.PlayerAdded:Connect(function(player)
    setupLeaderboard(player)
end)

-- Function to handle the kill event
local function handleKill(killerPlayer, victimPlayer)
    -- Increment the killer's kills and points
    if killerPlayer and victimPlayer and killerPlayer ~= victimPlayer then
        local killerStats = killerPlayer:FindFirstChild("leaderstats")
        if killerStats then
            -- Increment kills
            local kills = killerStats:FindFirstChild("Kills")
            if kills then
                kills.Value = kills.Value + 1
            end
            
            -- Increment points
            local points = killerStats:FindFirstChild("Points")
            if points then
                points.Value = points.Value + 10
            end
        end
    end
end

-- Connect the kill event to the function
Evt.Kill.OnServerEvent:Connect(handleKill)

Breakdown of the Code

  • Player Management:

    • On PlayerAdded, a leaderboard is established for each player, containing two stats: Kills and Points.
  • Kill Handling:

    • The function handleKill checks if the killerPlayer and victimPlayer are valid and not the same.
    • It increments the Kills value by 1 and Points value by 10 in the killer's leaderboard when a kill occurs.

Usage Example

  1. Ensure the above script is placed in a server script within Roblox Studio.
  2. Use the Evt.Kill signal elsewhere in your code to register a kill, passing the killer and victim players.

Final Notes

This update assumes that:

  • There is an Evt.Kill event that signals when a player is killed.
  • A leaderboard structure is set up to contain Kills and Points for each player.

By following these modifications, you'll be able to track player kills and update their scores effectively, enhancing gameplay and competitiveness. For further learning, consider courses available on the Enterprise DNA platform.

Create your Thread using our flexible tools, share it with friends and colleagues.

Your current query will become the main foundation for the thread, which you can expand with other tools presented on our platform. We will help you choose tools so that your thread is structured and logically built.

Description

This Lua script enhances a Roblox game by implementing a kill tracking system that updates player stats. When a player kills another, they receive +1 kill and +10 points, with their leaderboard updated accordingly.