Prompt: ---------------------[ TWEEN MODULE ]-------------------------------------------------

Response:
function tweenFoV(goal, frames)
 coroutine.resume(coroutine.create(function()
  SFn = SFn and SFn + 1 or 0
  local SFn_S = SFn
  for i = 1, frames do
   if SFn ~= SFn_S then break end
  		 Camera.FieldOfView = Camera.FieldOfView + (goal - Camera.FieldOfView) * (i / frames)
   game:GetService("RunService").RenderStepped:wait()
  end
 end))
end

function Lerp(n,g,t)
	return n+(g-n)*t
end

local RS = game:GetService("RunService")

function tweenJoint(Joint, newC0, newC1, Alpha, Duration)
	spawn(function()
		local newCode = math.random(-1e9, 1e9) --This creates a random code between -1000000000 and 1000000000
		local tweenIndicator = nil
		if (not Joint:findFirstChild("tweenCode")) then --If the joint isn't being tweened, then
			tweenIndicator = Instance.new("IntValue")
			tweenIndicator.Name = "tweenCode"
			tweenIndicator.Value = newCode
			tweenIndicator.Parent = Joint
		else
			tweenIndicator = Joint.tweenCode
			tweenIndicator.Value = newCode --If the joint is already being tweened, this will change the code, and the tween loop will stop
		end
		--local tweenIndicator = createTweenIndicator:InvokeServer(Joint, newCode)
		if Duration <= 0 then --If the duration is less than or equal to 0 then there's no need for a tweening loop
			if newC0 then Joint.C0 = newC0 end
			if newC1 then Joint.C1 = newC1 end
		else
			local Increment = 1.5 / Duration
			local startC0 = Joint.C0
			local startC1 = Joint.C1
			local X = 0
			while true do
				RS.RenderStepped:wait() --This makes the for loop step every 1/60th of a second
				local newX = X + Increment
				X = (newX > 90 and 90 or newX)
				if tweenIndicator.Value ~= newCode then break end --This makes sure that another tween wasn't called on the same joint
				if (not Equipped) then break end --This stops the tween if the tool is deselected
				if newC0 then Joint.C0 = startC0:lerp(newC0, Alpha(X)) end
				if newC1 then Joint.C1 = startC1:lerp(newC1, Alpha(X)) end
				if X == 90 then break end
			end
		end
		if tweenIndicator.Value == newCode then --If this tween functions was the last one called on a joint then it will remove the code
			tweenIndicator:Destroy()
		end
	end)
end

function LoadClientMods()
	for L_335_forvar1, L_336_forvar2 in pairs(GunMods:GetChildren()) do
		if L_336_forvar2:IsA('LocalScript') then
			local L_337_ = L_336_forvar2:clone()
			L_337_.Parent = ModStorageFolder
			L_337_.Disabled = false
		end
	end
end

function UnloadClientMods()
	for L_335_forvar1, L_336_forvar2 in pairs(ModStorageFolder:GetChildren()) do
		if L_336_forvar2:IsA('LocalScript') then
			L_336_forvar2:Destroy()
		end
	end
end

function CheckForHumanoid(L_225_arg1)
	local L_226_ = false
	local L_227_ = nil
	if L_225_arg1 then
		if (L_225_arg1.Parent:FindFirstChildOfClass("Humanoid") or L_225_arg1.Parent.Parent:FindFirstChildOfClass("Humanoid")) then
			L_226_ = true
			if L_225_arg1.Parent:FindFirstChildOfClass('Humanoid') then
				L_227_ = L_225_arg1.Parent:FindFirstChildOfClass('Humanoid')
			elseif L_225_arg1.Parent.Parent:FindFirstChildOfClass('Humanoid') then
				L_227_ = L_225_arg1.Parent.Parent:FindFirstChildOfClass('Humanoid')
			end
		else
			L_226_ = false
		end
	end
	return L_226_, L_227_
end

function CreateShell()
	delay(math.random(4,8)/10, function()
		if PastaFX:FindFirstChild('ShellCasing') then
			local Som = PastaFX.ShellCasing:clone()
			Som.Parent = Jogador.PlayerGui
			Som.PlaybackSpeed = math.random(30,50)/40
			Som.PlayOnRemove = true
			Debris:AddItem(Som, 0)
		end
	end)
end

local Tracers = 1
function TracerCalculation()
	local VisibleTracer
	if Settings.RandomTracer then
	if (math.random(1, 100) <= Settings.TracerChance) then
		VisibleTracer = true
	else
		VisibleTracer = false
	end
	else
		if Tracers >= Settings.TracerEveryXShots then
			VisibleTracer = true
			Tracers = 1
		else
			Tracers = Tracers + 1
		end
	end
	return VisibleTracer
end

function CreateBullet(BSpread)

	local Bullet = Instance.new("Part")
	Bullet.Name = Player.Name.."_Bullet"
	Bullet.CanCollide = false
	Bullet.Transparency = 1
	Bullet.FormFactor = "Custom"
	Bullet.Size = Vector3.new(1,1,1)
	local BulletMass = Bullet:GetMass()
	local Force = Vector3.new(0,BulletMass * (196.2) - (Settings.BDrop) * (196.2), 0)
	local BF = Instance.new("BodyForce")
	BF.force = Force
	BF.Parent = Bullet
	local Origin = ArmaClone.SmokePart.Position
	local Direction = ArmaClone.SmokePart.CFrame.lookVector + (ArmaClone.SmokePart.CFrame.upVector * (((Settings.BDrop*Zeroing.Value/2.8)/Settings.BSpeed))/2)
	local BulletCF = CFrame.new(Origin, Origin + Direction)
	local balaspread = CFrame.Angles(
			RAD(RAND(-BSpread - ((SpeedPrecision/Saude.Stances.Mobility.Value)*Settings.WalkMultiplier), BSpread + ((SpeedPrecision/Saude.Stances.Mobility.Value)*Settings.WalkMultiplier)) / 20),
			RAD(RAND(-BSpread - ((SpeedPrecision/Saude.Stances.Mobility.Value)*Settings.WalkMultiplier), BSpread + ((SpeedPrecision/Saude.Stances.Mobility.Value)*Settings.WalkMultiplier)) / 20),
			RAD(RAND(-BSpread - ((SpeedPrecision/Saude.Stances.Mobility.Value)*Settings.WalkMultiplier), BSpread + ((SpeedPrecision/Saude.Stances.Mobility.Value)*Settings.WalkMultiplier)) / 20)
		)
	Direction = balaspread * Direction

	Bullet.Parent = BulletModel
	Bullet.CFrame = BulletCF + Direction
	Bullet.Velocity = Direction * Settings.BSpeed
	local RainbowModeCode = Color3.fromRGB(math.random(0,255),math.random(0,255),math.random(0,255))

	local Visivel = TracerCalculation()

if Settings.BulletFlare == true and Visivel then
	local bg = Instance.new("BillboardGui", Bullet)
		bg.Adornee = Bullet
		bg.Enabled = false
		local flashsize = math.random(275, 375)/10
		bg.Size = UDim2.new(flashsize, 0, flashsize, 0)
		bg.LightInfluence = 0
		local flash = Instance.new("ImageLabel", bg)
		flash.BackgroundTransparency = 1
		flash.Size = UDim2.new(1, 0, 1, 0)
		flash.Position = UDim2.new(0, 0, 0, 0)
		flash.Image = "http://www.roblox.com/asset/?id=1047066405"

		if Settings.RainbowMode == true then
			flash.ImageColor3 = RainbowModeCode
		else
			flash.ImageColor3 = Settings.BulletFlareColor
		end
		flash.ImageTransparency = math.random(2, 5)/15
		spawn(function()
				wait(.2)
				if Bullet:FindFirstChild("BillboardGui") ~= nil then
				Bullet.BillboardGui.Enabled = true
				end
		end)
end

if Settings.Tracer == true and Visivel then

	local At1 = Instance.new("Attachment")
	At1.Name = "At1"
	At1.Position = Vector3.new(-(Settings.TracerWidth),0,0)
	At1.Parent = Bullet

	local At2  = Instance.new("Attachment")
	At2.Name = "At2"
	At2.Position = Vector3.new((Settings.TracerWidth),0,0)
	At2.Parent = Bullet

	local Particles = Instance.new("Trail")
	Particles.Transparency = NumberSequence.new({
				NumberSequenceKeypoint.new(0, 0, 0);
				NumberSequenceKeypoint.new(1, 1);
			}
		)
	Particles.WidthScale = NumberSequence.new({
				NumberSequenceKeypoint.new(0, 2, 0);
				NumberSequenceKeypoint.new(1, 1);
			}
		)

	if Settings.RainbowMode == true then
		Particles.Color = ColorSequence.new(RainbowModeCode)
	else
		Particles.Color = ColorSequence.new(Settings.TracerColor)
	end
	Particles.Texture = "rbxassetid://232918622"
	Particles.TextureMode = Enum.TextureMode.Stretch

	Particles.FaceCamera = true
	Particles.LightEmission = Settings.TracerLightEmission
	Particles.LightInfluence = Settings.TracerLightInfluence
	Particles.Lifetime = Settings.TracerLifeTime
	Particles.Attachment0 = At1
	Particles.Attachment1 = At2
	Particles.Parent = Bullet
end

if Settings.BulletLight == true and Visivel then
	local BulletLight = Instance.new("PointLight")
	BulletLight.Parent = Bullet
	BulletLight.Brightness = Settings.BulletLightBrightness
	if Settings.RainbowMode == true then
	BulletLight.Color = RainbowModeCode
	else
	BulletLight.Color = Settings.BulletLightColor
	end
	BulletLight.Range = Settings.BulletLightRange
	BulletLight.Shadows = true

end

	CreateShell()

	if Visivel then
		if ServerConfig.ReplicatedBullets then
			Evt.ServerBullet:FireServer(BulletCF, Settings.Tracer, Settings.BDrop, Settings.BSpeed, Direction, Settings.TracerColor,Ray_Ignore,Settings.BulletFlare,Settings.BulletFlareColor)
		end
	end
	game.Debris:AddItem(Bullet, 5)
	return Bullet

end

function CalcularDano(DanoBase,Dist,Vitima,Type)

	local damage = 0
	local VestDamage = 0
	local HelmetDamage = 0
	local Traveleddamage = DanoBase-(math.ceil(Dist)/40)*Settings.FallOfDamage
	if Vitima.Parent:FindFirstChild("Saude") ~= nil then

				local Vest =  Vitima.Parent.Saude.Protecao.VestVida
				local Vestfactor = Vitima.Parent.Saude.Protecao.VestProtect
				local Helmet = Vitima.Parent.Saude.Protecao.HelmetVida
				local Helmetfactor = Vitima.Parent.Saude.Protecao.HelmetProtect

		if Type == "Head" then
				if Helmet.Value > 0 and (Settings.BulletPenetration) < Helmetfactor.Value  then
					damage = Traveleddamage * ((Settings.BulletPenetration)/Helmetfactor.Value)
					HelmetDamage = (Traveleddamage * ((100 - Settings.BulletPenetration)/Helmetfactor.Value))

					if HelmetDamage <= 0 then
					HelmetDamage = 0.5
					end

				elseif Helmet.Value > 0 and (Settings.BulletPenetration) >= Helmetfactor.Value then
					damage = Traveleddamage
					HelmetDamage = (Traveleddamage * ((100 - Settings.BulletPenetration)/Helmetfactor.Value))

					if HelmetDamage <= 0 then
					HelmetDamage = 1
					end

				elseif Helmet.Value <= 0 then
					damage = Traveleddamage

				end
			else
				if Vest.Value > 0 and (Settings.BulletPenetration) < Vestfactor.Value  then
					damage = Traveleddamage * ((Settings.BulletPenetration)/Vestfactor.Value)
					VestDamage = (Traveleddamage * ((100 - Settings.BulletPenetration)/Vestfactor.Value))

					if VestDamage <= 0 then
					VestDamage = 0.5
					end

				elseif Vest.Value > 0 and (Settings.BulletPenetration) >= Vestfactor.Value then
					damage = Traveleddamage
					VestDamage = (Traveleddamage * ((100 - Settings.BulletPenetration)/Vestfactor.Value))

					if VestDamage <= 0 then
					VestDamage =  1
					end

				elseif Vest.Value <= 0 then
					damage = Traveleddamage

				end
			end
		else
			damage = Traveleddamage
	end
		if damage <= 0 then
			damage = 1
		end

	return damage,VestDamage,HelmetDamage
end

local WhizzSound = {"342190005"; "342190012"; "342190017"; "342190024";}

Evt.Whizz.OnClientEvent:connect(function()

	local Som = Instance.new('Sound')
	Som.Parent = Jogador.PlayerGui
	Som.SoundId = "rbxassetid://"..WhizzSound[math.random(1,4)]
	Som.Volume = 2
	Som.PlayOnRemove = true
	Som:Destroy()

end)

Evt.Suppression.OnClientEvent:Connect(function(Mode,Intensity,Tempo)
	if ServerConfig.EnableStatusUI and Jogador.Character and Human.Health > 0 then
		if Mode == 1 then

			TS:Create(StatusClone.Efeitos.Suppress,TweenInfo.new(.1),{ImageTransparency = 0, Size = UDim2.fromScale(1,1.15)}):Play()
			delay(.1,function()
				TS:Create(StatusClone.Efeitos.Suppress,TweenInfo.new(1,Enum.EasingStyle.Exponential,Enum.EasingDirection.InOut,0,false,0.15),{ImageTransparency = 1,Size = UDim2.fromScale(2,2)}):Play()
			end)
		else
			--local SKP_22 = script.FX.Dirty:clone()
			--SKP_22.Parent = Jogador.PlayerGui.StatusUI.Supressao
			--SKP_22.ImageTransparency = 0
			--SKP_22.BackgroundTransparency = (Intensity - 1) * -1

			--TS:Create(SKP_22,TweenInfo.new(0.25 ,Enum.EasingStyle.Linear,Enum.EasingDirection.In,0,false,0),{ImageTransparency = 0}):Play()
			--TS:Create(SKP_22,TweenInfo.new(Tempo/2 ,Enum.EasingStyle.Elastic,Enum.EasingDirection.In,0,false,0),{BackgroundTransparency = 1}):Play()

			--delay(Tempo/2,function()
			--TS:Create(SKP_22,TweenInfo.new(Tempo ,Enum.EasingStyle.Sine,Enum.EasingDirection.In,0,false,0),{ImageTransparency = 1}):Play()
			--TS:AddItem(SKP_22, Tempo)
			--end)
		end
	end
end)

function CastRay(Bala)

	local Hit2, Pos2, Norm2, Mat2
	local Hit, Pos, Norm, Mat
	local L_257_ = ArmaClone.SmokePart.Position;
	local L_258_ = Bala.Position;
	local TotalDistTraveled = 0
	local L_260_ = false
	local recast

	while true do
		RS.Heartbeat:wait()
		L_258_ = Bala.Position;
		TotalDistTraveled = TotalDistTraveled + (L_258_ - L_257_).magnitude

		Hit2, Pos2, Norm2, Mat2 = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_257_, (L_258_ - L_257_)*20), Ray_Ignore, false, true);

		Hit, Pos, Norm, Mat = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_257_, (L_258_ - L_257_)), Ray_Ignore, false, true);

		for L_264_forvar1, L_265_forvar2 in pairs(game.Players:GetChildren()) do
			if L_265_forvar2:IsA('Player') and L_265_forvar2 ~= Player and L_265_forvar2.Character and L_265_forvar2.Character:FindFirstChild('Head') and (L_265_forvar2.Character.Head.Position - Pos).magnitude <= Settings.SuppressMaxDistance and Settings.BulletWhiz and not L_260_ then
				Evt.Whizz:FireServer(L_265_forvar2)
				Evt.Suppression:FireServer(L_265_forvar2)
				L_260_ = true
			end
		end

		if TotalDistTraveled > Settings.Distance then
			Bala:Destroy()
			L_260_ = true
			break
		end

		if Hit2 then
			while not recast do
				if Hit2 and (Hit2 and Hit2.Transparency >= 1 or Hit2.CanCollide == false or Hit2.Name == "Ignorable" or Hit2.Name == "Glass" or Hit2.Parent.Name == "Top" or Hit2.Parent.Name == "Helmet" or Hit2.Parent.Name == "Up" or Hit2.Parent.Name == "Down" or Hit2.Parent.Name == "Face" or Hit2.Parent.Name == "Olho" or Hit2.Parent.Name == "Headset" or Hit2.Parent.Name == "Numero" or Hit2.Parent.Name == "Vest" or Hit2.Parent.Name == "Chest" or Hit2.Parent.Name == "Waist" or Hit2.Parent.Name == "Back" or Hit2.Parent.Name == "Belt" or Hit2.Parent.Name == "Leg1" or Hit2.Parent.Name == "Leg2" or Hit2.Parent.Name == "Arm1"  or Hit2.Parent.Name == "Arm2") and Hit2.Name ~= 'Right Arm' and Hit2.Name ~= 'Left Arm' and Hit2.Name ~= 'Right Leg' and Hit2.Name ~= 'Left Leg' and Hit2.Name ~= 'Armor' and Hit2.Name ~= 'EShield' then
					table.insert(Ray_Ignore, Hit2)
					recast = true
				end

				if recast then
					Hit2, Pos2, Norm2, Mat2 = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_257_, (L_258_ - L_257_)*20), Ray_Ignore, false, true);
					Hit, Pos, Norm, Mat = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_257_, (L_258_ - L_257_)), Ray_Ignore, false, true);
					recast = false
				else
					break
				end
			end
		end

		if Hit and not recast then
			Bala:Destroy()
			L_260_ = true
			local FoundHuman,VitimaHuman = CheckForHumanoid(Hit)
				Hitmarker.HitEffect(Ray_Ignore,ACS_Storage, Pos, Hit, Norm, Mat, Settings)
				Evt.Hit:FireServer(Pos, Hit, Norm, Mat,Settings,TotalDistTraveled)
			if FoundHuman == true and VitimaHuman.Health > 0 then
				if ServerConfig.HitmarkerSound then
					local hurtSound = PastaFX.Hitmarker:Clone()
					hurtSound.Parent = Player.PlayerGui
					hurtSound.Volume = 2
					hurtSound.PlayOnRemove = true
					Debris:AddItem(hurtSound,0)
				end

				if not  Settings.ModoTreino then
					Evt.CreateOwner:FireServer(VitimaHuman)

					if game.Players:FindFirstChild(VitimaHuman.Parent.Name) == nil then
							if Hit.Name == "Head" then
								local DanoBase = math.random(Settings.HeadDamage[1], Settings.HeadDamage[2])
								local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Head")
								Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
							elseif Hit.Name == "Torso" or Hit.Parent.Name == "UpperTorso" or Hit.Parent.Name == "LowerTorso" then
								local DanoBase = math.random(Settings.TorsoDamage[1], Settings.TorsoDamage[2])
								local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Body")
								Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
							else
								local DanoBase = math.random(Settings.LimbsDamage[1], Settings.LimbsDamage[2])
								local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Body")
								Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
							end

					else

					if not ServerConfig.TeamKill then
						if game.Players:FindFirstChild(VitimaHuman.Parent.Name) and game.Players:FindFirstChild(VitimaHuman.Parent.Name).Team ~= Player.Team or game.Players:FindFirstChild(VitimaHuman.Parent.Name) == nil then
							if Hit.Name == "Head" or Hit.Parent.Name == "Top" or Hit.Parent.Name == "Headset" or Hit.Parent.Name == "Olho" or Hit.Parent.Name == "Face" or Hit.Parent.Name == "Numero" then
								local DanoBase = math.random(Settings.HeadDamage[1], Settings.HeadDamage[2])
								local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Head")
								Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
							elseif (Hit.Parent:IsA('Accessory') or Hit.Parent:IsA('Hat')) then
								local DanoBase = math.random(Settings.HeadDamage[1], Settings.HeadDamage[2])
								local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Head")
								Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
							elseif Hit.Name == "Torso" or Hit.Parent.Name == "Chest" or Hit.Parent.Name == "Waist" then
								local DanoBase = math.random(Settings.TorsoDamage[1], Settings.TorsoDamage[2])
								local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Body")
								Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
							elseif Hit.Name == "Right Arm" or Hit.Name == "Right Leg" or Hit.Name == "Left Leg" or Hit.Name == "Left Arm" then
								local DanoBase = math.random(Settings.LimbsDamage[1], Settings.LimbsDamage[2])
								local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Body")
								Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
							end
						end
					else
						if game.Players:FindFirstChild(VitimaHuman.Parent.Name) and game.Players:FindFirstChild(VitimaHuman.Parent.Name).Team ~= Player.Team or game.Players:FindFirstChild(VitimaHuman.Parent.Name) == nil  then
							if Hit.Name == "Head" or Hit.Parent.Name == "Top" or Hit.Parent.Name == "Headset" or Hit.Parent.Name == "Olho" or Hit.Parent.Name == "Face" or Hit.Parent.Name == "Numero" then
								local DanoBase = math.random(Settings.HeadDamage[1], Settings.HeadDamage[2])
								local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Head")
								Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
							elseif (Hit.Parent:IsA('Accessory') or Hit.Parent:IsA('Hat')) then
								local DanoBase = math.random(Settings.HeadDamage[1], Settings.HeadDamage[2])
								local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Head")
								Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
							elseif Hit.Name == "Torso" or Hit.Parent.Name == "Chest" or Hit.Parent.Name == "Waist" then
								local DanoBase = math.random(Settings.TorsoDamage[1], Settings.TorsoDamage[2])
								local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Body")
								Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
							elseif Hit.Name == "Right Arm" or Hit.Name == "Right Leg" or Hit.Name == "Left Leg" or Hit.Name == "Left Arm" then
								local DanoBase = math.random(Settings.LimbsDamage[1], Settings.LimbsDamage[2])
								local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Body")
								Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
							end
						else
							if Hit.Name == "Head" or Hit.Parent.Name == "Top" or Hit.Parent.Name == "Headset" or Hit.Parent.Name == "Olho" or Hit.Parent.Name == "Face" or Hit.Parent.Name == "Numero" then
								local DanoBase = math.random(Settings.HeadDamage[1], Settings.HeadDamage[2])* ServerConfig.TeamDamageMultiplier
								local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Head")
								Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
							elseif (Hit.Parent:IsA('Accessory') or Hit.Parent:IsA('Hat')) then
								local DanoBase = math.random(Settings.HeadDamage[1], Settings.HeadDamage[2])* ServerConfig.TeamDamageMultiplier
								local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Head")
								Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
							elseif Hit.Name == "Torso" or Hit.Parent.Name == "Chest" or Hit.Parent.Name == "Waist" then
								local DanoBase = math.random(Settings.TorsoDamage[1], Settings.TorsoDamage[2])* ServerConfig.TeamDamageMultiplier
								local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Body")
								Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
							elseif Hit.Name == "Right Arm" or Hit.Name == "Right Leg" or Hit.Name == "Left Leg" or Hit.Name == "Left Arm" then
								local DanoBase = math.random(Settings.LimbsDamage[1], Settings.LimbsDamage[2])* ServerConfig.TeamDamageMultiplier
								local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Body")
								Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
							end
						end
					end
				end
				else
				if Hit.Name == "Head" or Hit.Parent.Name == "Top" or Hit.Parent.Name == "Headset" or Hit.Parent.Name == "Olho" or Hit.Parent.Name == "Face" or Hit.Parent.Name == "Numero"  or (Hit.Parent:IsA('Accessory') or Hit.Parent:IsA('Hat')) or Hit.Name == "Torso" or Hit.Parent.Name == "Chest" or Hit.Parent.Name == "Waist" or Hit.Name == "Right Arm" or Hit.Name == "Left Arm" or Hit.Name == "Right Leg" or Hit.Name == "Left Leg" or Hit.Parent.Name == "Back" or Hit.Parent.Name == "Leg1" or Hit.Parent.Name == "Leg2" or Hit.Parent.Name == "Arm1" or Hit.Parent.Name == "Arm2" then
					Evt.Treino:FireServer(VitimaHuman)
				end
			end
			break
			end
		end
		L_257_ = L_258_;
	end
end

Human.Running:connect(function(walkin)
	if Equipped then
		SpeedPrecision = walkin
		Sprint()
		if walkin > 1 then
			Walking = true
		else
			Walking = false
		end
	end
end)

Mouse.KeyDown:connect(function(Key)
	if Equipped then
		if Key == "w" then
			if not w then
				w = true
			end
		end
		if Key == "a" then
			if not a then
				a = true
			end
		end
		if Key == "s" then
			if not s then
				s = true
			end
		end
		if Key == "d" then
			if not d then
				d = true
			end
		end
	end
end)

Mouse.KeyUp:connect(function(Key)
	if Equipped then
		if Key == "w" then
			if w then
				w = false
			end
		end
		if Key == "a" then
			if a then
				a = false
			end
		end
		if Key == "s" then
			if s then
				s = false
			end
		end
		if Key == "d" then
			if d then
				d = false
			end
		end
	end
end)

function SlideEx()
						tweenJoint(ArmaClone.Handle:WaitForChild("Slide"),  CFrame.new(Settings.SlideExtend) * CFrame.Angles(0,math.rad(0),0) , nil, function(X) return math.sin(math.rad(X)) end, 1 * (FireRate/2))
						if Settings.MoveBolt == true then
						tweenJoint(ArmaClone.Handle:WaitForChild("Bolt"),  CFrame.new(Settings.BoltExtend) * CFrame.Angles(0,math.rad(0),0) , nil, function(X) return math.sin(math.rad(X)) end, 1 * (FireRate/2))
						end
						delay(FireRate/2,function()
							if Ammo.Value >= 1 then
								tweenJoint(ArmaClone.Handle:WaitForChild("Slide"),  CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0) , nil, function(X) return math.sin(math.rad(X)) end, 1 * (FireRate/2))
								if Settings.MoveBolt == true then
								tweenJoint(ArmaClone.Handle:WaitForChild("Bolt"),  CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0) , nil, function(X) return math.sin(math.rad(X)) end, 1 * (FireRate/2))
								end
							elseif Ammo.Value < 1 and Settings.SlideLock == true then
								Chambered.Value = false
								if Settings.MoveBolt == true and Settings.BoltLock == false then
								tweenJoint(ArmaClone.Handle:WaitForChild("Bolt"),  CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0) , nil, function(X) return math.sin(math.rad(X)) end, 1 * (FireRate/2))
								end
								ArmaClone.Handle.Click:Play()
								slideback = true
							elseif Ammo.Value < 1 and Settings.SlideLock == false then
								tweenJoint(ArmaClone.Handle:WaitForChild("Slide"),  CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0) , nil, function(X) return math.sin(math.rad(X)) end, 1 * (FireRate/2))
								if Settings.MoveBolt == true then
								tweenJoint(ArmaClone.Handle:WaitForChild("Bolt"),  CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0) , nil, function(X) return math.sin(math.rad(X)) end, 1 * (FireRate/2))
								end
								Chambered.Value = false
								ArmaClone.Handle.Click:Play()
							end
						end)
					end
function recoil()
		spawn(function()

					if Bipod then
						local vr  = (VRecoil)/5
						local hr = ((HRecoil) * math.random(-1, 1))/5

						Camera.CFrame = Camera.CFrame * CFrame.Angles(vr, hr, 0)
						local c = -vr/30
						local cx = -(hr)/30
						local curId
						local EquipId = curId
						local vP
						if Settings.GunType == 0 then
							vP = (VPunchBase)
						else
							vP = (VPunchBase*10)/100
						end
					local hP = (math.random(-HPunchBase*25, HPunchBase*25))/100
					local dP = ((DPunchBase) * math.random(-1, 1))
						if not Aiming then
							Recoil = Recoil:lerp(Recoil*CFrame.new(0,0,(Settings.RecoilPunch/2)) * CFrame.Angles(RAD(vP*RecoilPower*0.25),RAD(hP*RecoilPower*0.25),RAD(dP*RecoilPower*0.25)),1)
						else
							Recoil = Recoil:lerp(Recoil*CFrame.new(0,0,(Settings.RecoilPunch/2)) * CFrame.Angles(RAD(vP*RecoilPower*0.25),RAD(hP*RecoilPower*0.25),RAD(dP*RecoilPower*0.25)),1)
						end
						for i = 1, 30 do
							if EquipId == curId then
								Camera.CoordinateFrame = CFrame.new(Camera.Focus.p) * (Camera.CoordinateFrame - Camera.CoordinateFrame.p) * CFrame.Angles(c,  cx, 0) * CFrame.new(0, 0, (Camera.Focus.p - Camera.CoordinateFrame.p).magnitude)
								wait()
							else
								break
							end
						end
					else
						local vr  = (VRecoil)
						local hr = (HRecoil) * math.random(-1, 1)

						Camera.CFrame = Camera.CFrame * CFrame.Angles(vr, hr, 0)
						local c = -vr/30
						local cx = -(hr)/30
						local curId
						local EquipId = curId
						local vP
						if Settings.GunType == 0 then
							vP = (VPunchBase)
						else
							vP = (math.random(-VPunchBase*50,VPunchBase*100))/100
						end
					local hP = (math.random(-HPunchBase*100, HPunchBase*100))/100
					local dP = ((DPunchBase) * math.random(-1, 1))
						if not Aiming then
							Recoil = Recoil:lerp(Recoil*CFrame.new(0,0,(Settings.RecoilPunch)) * CFrame.Angles(RAD(vP*RecoilPower),RAD(hP*RecoilPower),RAD(dP*RecoilPower)),1)
						else
							Recoil = Recoil:lerp(Recoil*CFrame.new(0,0,(Settings.RecoilPunch/2)) * CFrame.Angles(RAD(vP*RecoilPower/Settings.AimRecoilReduction),RAD(hP*RecoilPower/Settings.AimRecoilReduction),RAD(dP*RecoilPower/Settings.AimRecoilReduction)),1)
						end
						for i = 1, 30*Settings.AimRecover do
								if EquipId == curId then
									Camera.CoordinateFrame = CFrame.new(Camera.Focus.p) * (Camera.CoordinateFrame - Camera.CoordinateFrame.p) * CFrame.Angles(c,  cx, 0) * CFrame.new(0, 0, (Camera.Focus.p - Camera.CoordinateFrame.p).magnitude)
									wait()
								else
									break
								end
							end
					end
				end)
				for _, v in pairs(ArmaClone.SmokePart:GetChildren()) do
				if v.Name:sub(1, 7) == "FlashFX" or v.Name:sub(1, 7) == "Smoke" then
					v.Enabled = true
					end
				end
				for _, a in pairs(ArmaClone.Chamber:GetChildren()) do
			if a.Name:sub(1, 7) == "FlashFX" or a.Name:sub(1, 7) == "Smoke" then
				a.Enabled = true
				end
			end

				delay(1 / 30, function()

					for _, v in pairs(ArmaClone.SmokePart:GetChildren()) do
						if v.Name:sub(1, 7) == "FlashFX" or v.Name:sub(1, 7) == "Smoke" then
							v.Enabled = false
						end
					end

					for _, a in pairs(ArmaClone.Chamber:GetChildren()) do
			if a.Name:sub(1, 7) == "FlashFX" or a.Name:sub(1, 7) == "Smoke" then
				a.Enabled = false
				end
			end

				end)
				if Silencer.Value == true then
					Character:WaitForChild('S'.. ArmaClone.Name):WaitForChild('Grip'):WaitForChild('Supressor'):Play()
				else
					Character:WaitForChild('S'.. ArmaClone.Name):WaitForChild('Grip'):WaitForChild('Fire'):Play()
					Character:WaitForChild('S'.. ArmaClone.Name):WaitForChild('Grip'):WaitForChild('Echo'):Play()
				end

				SlideEx()

end

function Emperrar()
	if Settings.CanBreak == true and Chambered.Value == true and (Ammo.Value - 1) > 0 then
	local Jam = math.random(Settings.JamChance)
	if Jam <= 2 then
		Emperrado.Value = true
		ArmaClone.Handle:WaitForChild("Click"):Play()
	end
end
end

function HalfStepFunc(Rot)
	if PlaceHolder then
		Offset = Human.CameraOffset
		Evt.HeadRot:FireServer(Rot, Offset, Equipped)
	end
	PlaceHolder = not PlaceHolder
end

oldtick = tick()
xTilt = 0
yTilt = 0
lastPitch = 0
lastYaw = 0
local TVal = 0

local L_199_ = nil
Personagem.ChildAdded:connect(function(Tool)
	if Tool:IsA('Tool') and Tool:FindFirstChild('ACS_Modulo') and Tool.ACS_Modulo:FindFirstChild('ACS_Setup') and Humanoid.Health > 0 and not ToolEquip and require(Tool.ACS_Modulo.ACS_Setup).Type == 'Gun' then
		local L_370_ = true
		if Personagem:WaitForChild('Humanoid').Sit and Personagem.Humanoid.SeatPart:IsA("VehicleSeat") or Personagem:WaitForChild('Humanoid').Sit and Personagem.Humanoid.SeatPart:IsA("VehicleSeat") or Nadando then
			L_370_ = false;
		end

		if L_370_ then
			L_199_ = Tool
			if not Equipped then
				uis.MouseIconEnabled = false
				Player.CameraMode = Enum.CameraMode.LockFirstPerson
				Setup(Tool)
				LoadClientMods()

	Ray_Ignore = {Character, Ignore_Model, Camera, BulletModel}

	Gui = StatusClone:WaitForChild("GunHUD")
	Gui.Visible = true
	CanUpdateGui = true
	Update_Gui()
	EquipAnim()
	if Settings.ZoomAnim and AimPartMode == 2 then
		ZoomAnim()
	end
	Sprint()
			elseif Equipped then
				Unset()
				Setup(L_199_)
				LoadClientMods()
			end;
		end;
	end
end)

Human.Seated:Connect(function(isSeated, seat)
	if isSeated and (seat:IsA("VehicleSeat")) then
		Unset()
		Humanoid:UnequipTools()
		Jogador.CameraMaxZoomDistance = ServerConfig.VehicleMaxZoom
	else
		Jogador.CameraMaxZoomDistance = game.StarterPlayer.CameraMaxZoomDistance
	end
end)

Jogador.Backpack.ChildRemoved:connect(function(L_371_arg1)
		Evt.Holster:FireServer(L_371_arg1)
end)

Personagem.ChildRemoved:connect(function(L_371_arg1)
	if L_371_arg1 == ArmaClient then
		if Equipped then
			if Balinha then
				Balinha:Destroy()
			end
			Unset()
		end
	end
end)

RS.RenderStepped:connect(function(Update)

	if not Equipped then
		HeadBase.CFrame = Camera.CFrame * CFrame.new(0, 0, -.5)
	else
		Update_Gui()
		HalfStepFunc(-math.asin(Camera.CoordinateFrame.lookVector.y))

		Recoil = Recoil:lerp(CFrame.new(),Settings.PunchRecover)

		--RA.C0 = Recoil
		--LA.C0 = Recoil

		local Raio = Ray.new(ArmaClone.Handle.Position, Camera.CFrame.LookVector * Settings.GunSize)
		local Hit, Pos = workspace:FindPartOnRayWithIgnoreList(Raio, Ray_Ignore, false, true)

		local lk = Camera.CoordinateFrame.lookVector
		local x = lk.X
		local rise = lk.Y
		local z = lk.Z

		local lookpitch, lookyaw = math.asin(rise), -math.atan(x / z)

		local pitchChange = lastPitch - lookpitch
		local yawChange = lastYaw - lookyaw
		pitchChange = pitchChange * ((math.abs(pitchChange) < 1) and 1 or 0)
		yawChange = yawChange * ((math.abs(yawChange) < 1) and 1 or 0)
		yTilt = (yTilt * 0.5 + pitchChange)
		xTilt = (xTilt * 0.5 + yawChange)

		lastPitch = lookpitch
		lastYaw = lookyaw

			sway.t = V3(xTilt, yTilt, TVal)
			local swayVec = sway.p
			local TWAY = swayVec.z
			local XSWY = swayVec.X * 5
			local YSWY = swayVec.Y * 5

			local xWalk = SIN(t*3)*(SpeedPrecision/ServerConfig.RunWalkSpeed *(WVal+1))
			local yWalk = COS(t*3)*(SpeedPrecision/ServerConfig.RunWalkSpeed *(WVal+1))
			local xWak  = SIN(t*1.75)*(SpeedPrecision/ServerConfig.RunWalkSpeed *(WVal+1))
			local yWak  = COS(t*3.5)*(SpeedPrecision/ServerConfig.RunWalkSpeed *(WVal+1))

			local zWalk = WVal
			Walk.t = Vector3.new(xWalk,yWalk,WVal)
			local Walk2 = Walk.p
			local xWalk2 = Walk2.X/3
			local yWalk2 = Walk2.Y/3
			local zWalk2 = Walk2.Z/10
			local xWalk3 = Walk2.X/1
			local yWalk3 = Walk2.Y/1
			if Clone then
				if Aiming then
					zWalk = 0
				else
					zWalk = WVal
				end
				if Walking then
					WalkRate = (Human.WalkSpeed/3)
					if a then
						TVal = Lerp(0,(-.20*SpeedPrecision/ServerConfig.RunWalkSpeed),10)
					elseif d then
						TVal = Lerp(0,(.20*SpeedPrecision/ServerConfig.RunWalkSpeed),10)
					else
						TVal = Lerp(0,0,10)
					end
				else
					WalkRate = (SpeedPrecision/ServerConfig.RunWalkSpeed) + .5
					WVal = Lerp(0,0,10)
				end
				local currtick = tick()
				t = t + (((currtick - OldTick)*WalkRate))
				OldTick = currtick
				local Sway = CFa(YSWY*RAD(5),-XSWY*RAD(5),-XSWY*RAD(0))
				Waval = Waval:lerp(CFn(xWalk3/220,-yWalk3/180,0)*CFn(xWak/220,-yWak/180,0)*CFa(0,0,zWalk2/5)*CFa(0,0,(TWAY/2)/10),1)
				Clone.C0 = Clone.C0:lerp(Waval*Sway,1)
			end
			if OverHeat and Can_Shoot then
			delay(5,function()
			if Can_Shoot then
			OverHeat = false
			end
			end)
		end

		if BSpread then
		local currTime = time()
		if currTime - LastSpreadUpdate > FireRate * 2 then
			LastSpreadUpdate = currTime
			BSpread = math.max(Settings.MinSpread, BSpread - (Settings.AimInaccuracyStepAmount)/5)
			RecoilPower =  math.max(Settings.MinRecoilPower, RecoilPower - (Settings.RecoilPowerStepAmount)/4)
		end
	end

	if OverHeat then
		ArmaClone.SmokePart.OverHeat.Enabled = true
	else
		ArmaClone.SmokePart.OverHeat.Enabled = false
	end

		if Aiming then
			if not NVG or ArmaClone.AimPart:FindFirstChild("NVAim") == nil then
				if AimPartMode == 1 and ArmaClone:FindFirstChild("AimPart2") ~= nil then
					Clone.C1 = Clone.C1:Lerp(Clone.C1 * Clone.C0:inverse() * Recoil * CFrame.new() * ArmaClone.AimPart.CFrame:toObjectSpace(HeadBase.CFrame),0.15)
				elseif AimPartMode == 2 and ArmaClone:FindFirstChild("AimPart2") ~= nil then
					Clone.C1 = Clone.C1:Lerp(Clone.C1 * Clone.C0:inverse() * Recoil * ArmaClone.AimPart2.CFrame:toObjectSpace(HeadBase.CFrame),0.15)
				else
					Clone.C1 = Clone.C1:Lerp(Clone.C1 * Clone.C0:inverse() * Recoil * ArmaClone.AimPart.CFrame:toObjectSpace(HeadBase.CFrame),0.15)
				end
			else
				if not Bipod then
					Clone.C1 = Clone.C1:Lerp(Clone.C1 * Clone.C0:inverse() * Recoil * CFrame.new() * (ArmaClone.AimPart.CFrame * ArmaClone.AimPart.NVAim.CFrame):toObjectSpace(HeadBase.CFrame),0.15)
				else
					Aiming = false
					stance = 0
				end
			end
		else
			if Hit and stance == 0 and Bipod == false then
				Clone.C1 = Clone.C1:Lerp(Clone.C0:inverse() * Recoil * CFrame.new(0,0,(((ArmaClone.Handle.Position - Pos).magnitude/Settings.GunSize) - 1) * -Settings.GunFOVReduction) ,0.15)
			else
				Clone.C1 = Clone.C1:Lerp(Clone.C0:inverse() * Recoil * CFrame.new(),0.15)
			end
		end

		if ArmaClone:FindFirstChild("BipodPoint") ~= nil then

			local BipodRay = Ray.new(ArmaClone.BipodPoint.Position, ArmaClone.BipodPoint.CFrame.UpVector * -1.75)
			local BipodHit, BipodPos, BipodNorm = workspace:FindPartOnRayWithIgnoreList(BipodRay, Ray_Ignore, false, true)

			if BipodHit and (stance == 0 or stance == 2) then
				Gui.Bipod.ImageColor3 = Color3.fromRGB(255, 255, 0)
				BipodEnabled = true
				if BipodEnabled and Bipod then
					Gui.Bipod.ImageColor3 = Color3.fromRGB(255, 255, 255)
					local StaminaValue = 0
					HeadBase.CFrame = Camera.CFrame * CFrame.new(0, 0, -.5) * CFrame.Angles( math.rad(StaminaValue * math.sin( tick() * 2.5 )),math.rad(StaminaValue * math.sin( tick() * 1.25 )), 0)
					if stance == 0 and not Aiming then
						Clone.C1 = Clone.C1:Lerp(Clone.C0:inverse() * Recoil * CFrame.new(0,(((ArmaClone.BipodPoint.Position - BipodPos).magnitude)-1) * (-1.5), 0) ,0.15)
					end
				else
					Gui.Bipod.ImageColor3 = Color3.fromRGB(255, 255, 0)
					local StaminaValue = Settings.SwayBase + (1-(Personagem.Saude.Variaveis.Stamina.Value/Personagem.Saude.Variaveis.Stamina.MaxValue))* Settings.MaxSway
					HeadBase.CFrame = Camera.CFrame * CFrame.new(0, 0, -.5) * CFrame.Angles( math.rad(StaminaValue * math.sin( tick() * 2.5 )),math.rad(StaminaValue * math.sin( tick() * 1.25 )), 0)
				end
			else
				Gui.Bipod.ImageColor3 = Color3.fromRGB(255, 0, 0)
				Bipod = false
				BipodEnabled = false
				local StaminaValue = Settings.SwayBase + (1-(Personagem.Saude.Variaveis.Stamina.Value/Personagem.Saude.Variaveis.Stamina.MaxValue))* Settings.MaxSway
				HeadBase.CFrame = Camera.CFrame * CFrame.new(0, 0, -.5) * CFrame.Angles( math.rad(StaminaValue * math.sin( tick() * 2.5 )),math.rad(StaminaValue * math.sin( tick() * 1.25 )), 0)
			end

		else
			Gui.Bipod.ImageColor3 = Color3.fromRGB(255, 0, 0)
			local StaminaValue = Settings.SwayBase + (1-(Personagem.Saude.Variaveis.Stamina.Value/Personagem.Saude.Variaveis.Stamina.MaxValue))* Settings.MaxSway
			HeadBase.CFrame = Camera.CFrame * CFrame.new(0, 0, -.5) * CFrame.Angles( math.rad(StaminaValue * math.sin( tick() * 2.5 )),math.rad(StaminaValue * math.sin( tick() * 1.25 )), 0)
		end

		if Equipped and LaserAtivo then
			if NVG then
				Pointer.Transparency = 0
				Laser.Enabled = true

			else

				if not ServerConfig.RealisticLaser then
					Laser.Enabled = true
				else
					Laser.Enabled = false
				end

				if IRmode then
					Pointer.Transparency = 1
				else
					Pointer.Transparency = 0
				end
			end

			local L_361_ = Ray.new(ArmaClone.LaserPoint.Position, AnimBase.CFrame.lookVector * 999)
			local Hit, Pos, Normal = workspace:FindPartOnRayWithIgnoreList(L_361_, Ray_Ignore, false, true)

			LaserEP.CFrame = CFrame.new(0, 0, -LaserDist)
			Pointer.CFrame =  CFrame.new(Pos, Pos + Normal)

			if Hit then
				LaserDist = (ArmaClone.LaserPoint.Position - Pos).magnitude
			else
				LaserDist = 999
			end
			Evt.SVLaser:FireServer(Pos,1,ArmaClone.LaserPoint.Color,ArmaClient,IRmode)
		end
end
	end)

Evt.SVFlash.OnClientEvent:Connect(function(Player,Mode,Arma,Angle,Bright,Color,Range)
	if Player ~= Jogador and Player.Character['S' .. Arma.Name].Grip:FindFirstChild("Flash") ~= nil then
		local Arma = Player.Character['S' .. Arma.Name]
		local Luz = Instance.new("SpotLight")
		local bg = Instance.new("BillboardGui")

		if Mode == true then
		Luz.Parent = Arma.Grip.Flash
		Luz.Angle = Angle
		Luz.Brightness = Bright
		Luz.Range = Range
		Luz.Color = Color

		bg.Parent = Arma.Grip.Flash
		bg.Adornee = Arma.Grip.Flash
		bg.Size = UDim2.new(10, 0, 10, 0)

		local flash = Instance.new("ImageLabel", bg)
		flash.BackgroundTransparency = 1
		flash.Size = UDim2.new(1, 20, 1, 20)
		flash.AnchorPoint = Vector2.new(0.5,0.5)
		flash.Position = UDim2.new(0.5, 0, 0.5, 0)
		flash.Image = "http://www.roblox.com/asset/?id=1847258023"
		flash.ImageColor3 = Color
		flash.ImageTransparency = 0.25
		flash.Rotation = math.random(-45, 45)

		else
			if Arma.Grip.Flash:FindFirstChild("SpotLight") ~= nil then
				Arma.Grip.Flash:FindFirstChild("SpotLight"):Destroy()
			end
			if Arma.Grip.Flash:FindFirstChild("BillboardGui") ~= nil then
				Arma.Grip.Flash:FindFirstChild("BillboardGui"):Destroy()
			end
		end
	end
end)

Evt.SVLaser.OnClientEvent:Connect(function(Player,Position,Modo,Cor,Arma,IR)

if Player ~= Jogador then

	if BulletModel:FindFirstChild(Player.Name.."_Laser") == nil then
		local Dot = Instance.new('Part')
		local Att0 = Instance.new('Attachment')
		Att0.Name = "Att0"
		Att0.Parent = Dot
		Dot.Name = Player.Name.."_Laser"
		Dot.Parent = BulletModel
		Dot.Transparency = 1

		if Player.Character and Player.Character:FindFirstChild('S'.. Arma.Name) ~= nil and Player.Character:WaitForChild('S'.. Arma.Name):WaitForChild('Grip'):FindFirstChild("Laser") ~= nil then
		local Muzzle = Player.Character:WaitForChild('S'.. Arma.Name):WaitForChild('Grip'):WaitForChild("Laser")

		local Laser = Instance.new('Beam')
			Laser.Parent = Dot
			Laser.Transparency = NumberSequence.new(0)
			Laser.LightEmission = 1
			Laser.LightInfluence = 0
			Laser.Attachment0 = Att0
			Laser.Attachment1 = Muzzle
			Laser.Color = ColorSequence.new(Cor)
			Laser.FaceCamera = true
			Laser.Width0 = 0.01
			Laser.Width1 = 0.01
		if not NVG then
			Laser.Enabled = false
		end
	end
	end

if Modo == 1 then
	if BulletModel:FindFirstChild(Player.Name.."_Laser") ~= nil then
		local LA = BulletModel:FindFirstChild(Player.Name.."_Laser")
		LA.Shape = 'Ball'
		LA.Size = Vector3.new(0.2, 0.2, 0.2)
		LA.CanCollide = false
		LA.Anchored = true
		LA.Color = Cor
		LA.Material = Enum.Material.Neon
		LA.Position = Position

		if NVG then

			LA.Transparency = 0

			if LA:FindFirstChild("Beam") ~= nil then
				LA.Beam.Enabled = true
			end

		else

			if Player.Character and Player.Character:FindFirstChild('S'.. Arma.Name) ~= nil and Player.Character:WaitForChild('S'.. Arma.Name):WaitForChild('Grip'):FindFirstChild("Laser") ~= nil then
				if IR then
					LA.Transparency = 1
				else
					LA.Transparency = 0
				end
			end

			if LA:FindFirstChild("Beam") ~= nil then
				LA.Beam.Enabled = false
			end

		end

	end

elseif Modo == 2 then
	if BulletModel:FindFirstChild(Player.Name.."_Laser") ~= nil then
		local LA = BulletModel:FindFirstChild(Player.Name.."_Laser")
		LA:Destroy()
	end
end
end
end)

function Launcher()
	if Settings.FireModes.Explosive == true then
		Character:WaitForChild('S'.. ArmaClone.Name):WaitForChild('Grip'):WaitForChild('Fire2'):Play()

	local M203 = Instance.new("Part")
	M203.Shape = 'Ball'
	M203.CanCollide = false
	M203.Size = Vector3.new(0.25,0.25,0.25)
	M203.Material = Enum.Material.Metal
	M203.Color = Color3.fromRGB(27, 42, 53)
	M203.Parent = BulletModel
	M203.CFrame = ArmaClone.SmokePart2.CFrame
	M203.Velocity = ArmaClone.SmokePart2.CFrame.lookVector*(600-196.2)

	local At1 = Instance.new("Attachment")
	At1.Name = "At1"
	At1.Position = Vector3.new(-.15,0,0)
	At1.Parent = M203

	local At2  = Instance.new("Attachment")
	At2.Name = "At2"
	At2.Position = Vector3.new(.15,0,0)
	At2.Parent = M203

	local Particles = Instance.new("Trail")
	Particles.Transparency = NumberSequence.new({
				NumberSequenceKeypoint.new(0, 0, 0);
				NumberSequenceKeypoint.new(1, 1);
			}
		)
	Particles.WidthScale = NumberSequence.new({
				NumberSequenceKeypoint.new(0, 2, 0);
				NumberSequenceKeypoint.new(1, 1);
			}
		)

	Particles.Texture = "rbxassetid://232918622"
	Particles.TextureMode = Enum.TextureMode.Stretch

	Particles.FaceCamera = true
	Particles.LightEmission = 0
	Particles.LightInfluence = 1
	Particles.Lifetime = 0.2
	Particles.Attachment0 = At1
	Particles.Attachment1 = At2
	Particles.Parent = M203

	local Hit2, Pos2, Norm2, Mat2
	local Hit, Pos, Norm, Mat
	local L_257_ = ArmaClone.SmokePart2.Position;
	local L_258_ = M203.Position;
	local L_260_ = false
	local recast

	while true do
		RS.Heartbeat:wait()
		L_258_ = M203.Position;

		Hit2, Pos2, Norm2, Mat2 = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_257_, (L_258_ - L_257_)*20), Ray_Ignore, false, true);

		Hit, Pos, Norm, Mat = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_257_, (L_258_ - L_257_)), Ray_Ignore, false, true);

		if Hit2 then
			while not recast do
				if Hit2 and (Hit2 and Hit2.Transparency >= 1 or Hit2.CanCollide == false or Hit2.Name == "Ignorable" or Hit2.Name == "Glass" or Hit2.Parent.Name == "Top" or Hit2.Parent.Name == "Helmet" or Hit2.Parent.Name == "Up" or Hit2.Parent.Name == "Down" or Hit2.Parent.Name == "Face" or Hit2.Parent.Name == "Olho" or Hit2.Parent.Name == "Headset" or Hit2.Parent.Name == "Numero" or Hit2.Parent.Name == "Vest" or Hit2.Parent.Name == "Chest" or Hit2.Parent.Name == "Waist" or Hit2.Parent.Name == "Back" or Hit2.Parent.Name == "Belt" or Hit2.Parent.Name == "Leg1" or Hit2.Parent.Name == "Leg2" or Hit2.Parent.Name == "Arm1"  or Hit2.Parent.Name == "Arm2") and Hit2.Name ~= 'Right Arm' and Hit2.Name ~= 'Left Arm' and Hit2.Name ~= 'Right Leg' and Hit2.Name ~= 'Left Leg' and Hit2.Name ~= 'Armor' and Hit2.Name ~= 'EShield' then
					table.insert(Ray_Ignore, Hit2)
					recast = true
				end

				if recast then
					Hit2, Pos2, Norm2, Mat2 = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_257_, (L_258_ - L_257_)*20), Ray_Ignore, false, true);
					Hit, Pos, Norm, Mat = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_257_, (L_258_ - L_257_)), Ray_Ignore, false, true);
					recast = false
				else
					break
				end
			end
		end

			if Hit and not recast then
				Evt.LauncherHit:FireServer(Pos, Hit, Norm, Mat)
				Hitmarker.Explosion(Pos, Hit, Norm)
				M203:remove()

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

		local Exp = Instance.new("Explosion")
		Exp.BlastPressure = 0
		Exp.BlastRadius = Settings.LauncherRadius
		Exp.DestroyJointRadiusPercent = 0
		Exp.Position = Hitmark.Position
		Exp.Parent = Hitmark
		Exp.Visible = false

		Exp.Hit:connect(function(hitPart, partDistance)

  		local FoundHuman,VitimaHuman = CheckForHumanoid(hitPart)
			local damage = math.random(Settings.LauncherDamage[1],Settings.LauncherDamage[2])
    			if FoundHuman == true and VitimaHuman.Health > 0 then
    		  	  local distance_factor = partDistance / Exp.BlastRadius    -- 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
						Evt.Damage:FireServer(VitimaHuman,(damage*distance_factor),0,0)
  					 end
				end
		end)

				break
			end
			L_257_ = L_258_;
		end
	end
end

Evt.LauncherHit.OnClientEvent:Connect(function(Player, Position, HitPart, Normal)
	if Player ~= Jogador then
		Hitmarker.Explosion(Position, HitPart, Normal)
	end
end)

Mouse.Button1Down:connect(function()
	if Equipped then
	MouseHeld = true

if Settings.Mode ~= "Explosive" then
	if slideback or not Chambered.Value == true or Emperrado.Value == true then
		ArmaClone.Handle.Click:Play()
		return
	end
elseif Settings.Mode == "Explosive" and GLChambered.Value == false or GLAmmo.Value <= 0 then
	ArmaClone.Handle.Click:Play()
	return
end

	if Can_Shoot and not Reloading and not Safe and not Correndo then
	Can_Shoot = false
	if Settings.Mode == "Semi" and Ammo.Value > 0 and Emperrado.Value == false then
		Evt.Atirar:FireServer(FireRate,Anims,ArmaClient)
		for _ = 1, Settings.Bullets do
			coroutine.resume(coroutine.create(function()
			Balinha = CreateBullet(BSpread)
			CastRay(Balinha)
				end))
			end
		recoil()
		Emperrar()
		if Emperrado.Value == false then
			--EjectShells()
		end
		Ammo.Value = Ammo.Value - 1

		if BSpread and not DecreasedAimLastShot then
				BSpread = math.min(Settings.MaxSpread, BSpread + Settings.AimInaccuracyStepAmount)
				RecoilPower =  math.min(Settings.MaxRecoilPower, RecoilPower + Settings.RecoilPowerStepAmount)
			end
			DecreasedAimLastShot = not DecreasedAimLastShot
			if BSpread >= Settings.MaxSpread then
				OverHeat = true
			end

		wait(FireRate)
	elseif Settings.Mode == "Auto" then
		while MouseHeld and Equipped and not Can_Shoot and Emperrado.Value == false and Ammo.Value > 0 do
			Evt.Atirar:FireServer(FireRate,Anims,ArmaClient)
			for _ = 1, Settings.Bullets do
			coroutine.resume(coroutine.create(function()
			Balinha = CreateBullet(BSpread)
			CastRay(Balinha)
			end))
			end
			recoil()
			Emperrar()
			if Emperrado.Value == false then
			--EjectShells()
			end
			Ammo.Value = Ammo.Value - 1

			if BSpread and not DecreasedAimLastShot then
				BSpread = math.min(Settings.MaxSpread, BSpread + Settings.AimInaccuracyStepAmount)
				RecoilPower =  math.min(Settings.MaxRecoilPower, RecoilPower + Settings.RecoilPowerStepAmount)
			end
			DecreasedAimLastShot = not DecreasedAimLastShot
			if BSpread >= Settings.MaxSpread then
				OverHeat = true
			end

			wait(FireRate)
		end
	elseif Settings.Mode == "Burst" and Ammo.Value > 0 then
		for i = 1, Settings.BurstShot do
			for _ = 1, Settings.Bullets do
				if MouseHeld and Ammo.Value > 0 and Emperrado.Value == false then
					Evt.Atirar:FireServer(FireRate,Anims,ArmaClient)
					coroutine.resume(coroutine.create(function()
					Balinha = CreateBullet(BSpread)
					CastRay(Balinha)
					end))
					recoil()
					Emperrar()
					if Emperrado.Value == false then
					--EjectShells()
					end
					Ammo.Value = Ammo.Value - 1
				end
			end

			if BSpread and not DecreasedAimLastShot then
				BSpread = math.min(Settings.MaxSpread, BSpread + Settings.AimInaccuracyStepAmount)
				RecoilPower =  math.min(Settings.MaxRecoilPower, RecoilPower + Settings.RecoilPowerStepAmount)
			end
			DecreasedAimLastShot = not DecreasedAimLastShot
			if BSpread >= Settings.MaxSpread then
				OverHeat = true
			end

			wait(BurstFireRate)
		end
		elseif Settings.Mode == "Bolt-Action" or Settings.Mode == "Pump-Action" and Ammo.Value > 0 and Emperrado.Value == false then
		Evt.Atirar:FireServer(FireRate,Anims,ArmaClient)
		for _ = 1, Settings.Bullets do

		coroutine.resume(coroutine.create(function()
		Balinha = CreateBullet(BSpread)
		CastRay(Balinha)
		end))
			end
		recoil()
		if (Ammo.Value - 1) > 0 then
		Emperrado.Value = true
		end
		if Emperrado == false then
			--EjectShells()
		end
		Ammo.Value = Ammo.Value - 1
		if BSpread and not DecreasedAimLastShot then
				BSpread = math.min(Settings.MaxSpread, BSpread + Settings.AimInaccuracyStepAmount)
				RecoilPower =  math.min(Settings.MaxRecoilPower, RecoilPower + Settings.RecoilPowerStepAmount)
			end
			DecreasedAimLastShot = not DecreasedAimLastShot
			if BSpread >= Settings.MaxSpread then
				OverHeat = true
			end
		if (Settings.AutoChamber) then
		if Aiming and (Settings.ChamberWhileAim) then
			MouseHeld = false
			Can_Shoot = false
			Reloading = true
			ChamberAnim()
			Sprint()
			Can_Shoot = true
			Reloading = false
		elseif not Aiming then
			MouseHeld = false
			Can_Shoot = false
			Reloading = true
			ChamberAnim()
			Sprint()
			Can_Shoot = true
			Reloading = false
		end
		end
		wait(FireRate)

	elseif Settings.Mode == "Explosive" and GLAmmo.Value > 0 and GLChambered.Value == true and not Correndo then
		GLChambered.Value = false
		GLAmmo.Value = GLAmmo.Value - 1
		coroutine.resume(coroutine.create(function()
		Launcher()
		end))
	end
	Can_Shoot = true
	Update_Gui()
	end
	end
end)

Mouse.Button1Up:connect(function()
	if Equipped then
		MouseHeld = false
	end
end)

Mouse.WheelForward:connect(function()
if Equipped and not Aiming and not Reloading and not Correndo then
	MouseHeld = false
	if stance == 0 then
		Safe = true
		stance = 1
		Evt.Stance:FireServer(stance,Settings,Anims)
		StanceUp()
	elseif stance == -1 then
		Safe = false
		stance = 0
		Evt.Stance:FireServer(stance,Settings,Anims)
		IdleAnim()
	elseif stance == -2 then
		Safe = true
		stance = -1
		Evt.Stance:FireServer(stance,Settings,Anims)
		StanceDown()
	end
	Update_Gui()
end

if Equipped and Aiming and Sens.Value < 100 then
	Sens.Value = Sens.Value + 5
	Update_Gui()
	game:GetService('UserInputService').MouseDeltaSensitivity = (Sens.Value/100)
end

end)

Mouse.WheelBackward:connect(function()
if Equipped and not Aiming and not Reloading and not Correndo then
	MouseHeld = false
	if stance == 0 then
		Safe = true
		stance = -1
		Evt.Stance:FireServer(stance,Settings,Anims)
		StanceDown()
	elseif stance == -1 then
		Safe = true
		stance = -2
		Evt.Stance:FireServer(stance,Settings,Anims)
		Patrol()
	elseif stance == 1 then
		Safe = false
		stance = 0
		Evt.Stance:FireServer(stance,Settings,Anims)
		IdleAnim()
	end
	Update_Gui()
end

if Equipped and Aiming and Sens.Value > 5 then
	Sens.Value = Sens.Value - 5
	Update_Gui()
	game:GetService('UserInputService').MouseDeltaSensitivity = (Sens.Value/100)
end

end)

Mouse.Button2Down:connect(function()
	if Equipped and stance > -2 and not Aiming and (Camera.Focus.p - Camera.CFrame.p).magnitude < 1 and not Correndo then
		if NVG and ArmaClone.AimPart:FindFirstChild("NVAim") ~= nil and Bipod then
		else
			if Safe then
				Safe = false
				IdleAnim()
				Update_Gui()
			end
			stance = 2
			Evt.Stance:FireServer(stance,Settings,Anims)
			Aiming = true
			game:GetService('UserInputService').MouseDeltaSensitivity = (Sens.Value/100)
			ArmaClone.Handle.AimDown:Play()

if not NVG or ArmaClone.AimPart:FindFirstChild("NVAim") == nil then
	if ArmaClone:FindFirstChild('AimPart2') ~= nil then
		if AimPartMode == 1 then
			tweenFoV(Settings.ChangeFOV[1],120)
			if Settings.FocusOnSight then
					TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.75),{ImageTransparency = 0}):Play()
				else
					TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.3),{ImageTransparency = 1}):Play()
				end
		elseif AimPartMode == 2 then
			tweenFoV(Settings.ChangeFOV[2],120)
			if Settings.FocusOnSight2 then
					TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.75),{ImageTransparency = 0}):Play()
				else
					TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.3),{ImageTransparency = 1}):Play()
				end
		end
	else
		if AimPartMode == 1 then
			tweenFoV(Settings.ChangeFOV[1],120)
			if Settings.FocusOnSight then
					TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.75),{ImageTransparency = 0}):Play()
				else
					TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.3),{ImageTransparency = 1}):Play()
				end
		elseif AimPartMode == 2 then
			tweenFoV(Settings.ChangeFOV[2],120)
			if Settings.FocusOnSight2 then
					TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.75),{ImageTransparency = 0}):Play()
				else
					TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.3),{ImageTransparency = 1}):Play()
				end
			end
		end
	else
		tweenFoV(70,120)
		TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.3),{ImageTransparency = 1}):Play()
	end
end
		elseif Aiming and Equipped  then
			stance = 0
			Evt.Stance:FireServer(stance,Settings,Anims)
			game:GetService('UserInputService').MouseDeltaSensitivity = 1
			ArmaClone.Handle.AimUp:Play()
			tweenFoV(70,120)
			Aiming = false
			TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.3),{ImageTransparency = 1}):Play()
	end
end)

Human.Died:connect(function()
	ResetWorkspace()
	Human:UnequipTools()
	Evt.Rappel.CutEvent:FireServer()
	Unset()
end)

function onStateChanged(_,state)
	if state == Enum.HumanoidStateType.Swimming then
		Nadando = true
	if Equipped then
		Unset()
		Humanoid:UnequipTools()
	end
	else
		Nadando = false
	end

	if ServerConfig.EnableFallDamage then
		if state == Enum.HumanoidStateType.Freefall and not falling then
			falling = true
			local curVel = 0
			local peak = 0

			while falling do
				curVel = HumanoidRootPart.Velocity.magnitude
				peak = peak + 1
				wait()
			end
			local damage = (curVel - (ServerConfig.MaxVelocity)) * ServerConfig.DamageMult
			if damage > 5 and peak > 20 then
					local hurtSound = PastaFX.FallDamage:Clone()
					hurtSound.Parent = Player.PlayerGui
					hurtSound.Volume = damage/Human.MaxHealth
					hurtSound:Play()
					Debris:AddItem(hurtSound,hurtSound.TimeLength)
				Evt.Damage:FireServer(Human,damage,0,0)
			end
		elseif state == Enum.HumanoidStateType.Landed or state == Enum.HumanoidStateType.Dead then
			falling = false
		end
	end
end

Evt.ServerBullet.OnClientEvent:Connect(function(SKP_arg1,SKP_arg3,SKP_arg4,SKP_arg5,SKP_arg6,SKP_arg7,SKP_arg8,SKP_arg9,SKP_arg10,SKP_arg11,SKP_arg12)
if SKP_arg1 ~= Jogador and SKP_arg1.Character then
local SKP_01 = SKP_arg3
	local SKP_02 = Instance.new("Part")
	SKP_02.Parent = workspace.ACS_WorkSpace.Server
	SKP_02.Name = SKP_arg1.Name..'_Bullet'
	Debris:AddItem(SKP_02, 5)
	SKP_02.Shape = "Ball"
	SKP_02.Size = Vector3.new(1, 1, 1)
	SKP_02.CanCollide = false
	SKP_02.CFrame = SKP_01
	SKP_02.Transparency = 1

	local SKP_03 = SKP_02:GetMass()
	local SKP_04 = Instance.new('BodyForce', SKP_02)

	SKP_04.Force = Vector3.new(0,SKP_03 * (196.2) - SKP_arg5 * (196.2), 0)
	SKP_02.Velocity = SKP_arg7 * SKP_arg6

	local SKP_05 = Instance.new('Attachment', SKP_02)
	SKP_05.Position = Vector3.new(0.1, 0, 0)
	local SKP_06 = Instance.new('Attachment', SKP_02)
	SKP_06.Position = Vector3.new(-0.1, 0, 0)

	if SKP_arg4 then
		local SKP_07 = Instance.new('Trail', SKP_02)
		SKP_07.Attachment0 = SKP_05
		SKP_07.Attachment1 = SKP_06
		SKP_07.Transparency = NumberSequence.new({
				NumberSequenceKeypoint.new(0, 0, 0);
				NumberSequenceKeypoint.new(1, 1);
			}
		)
		SKP_07.WidthScale = NumberSequence.new({
				NumberSequenceKeypoint.new(0, 2, 0);
				NumberSequenceKeypoint.new(1, 0);
			}
		)
		SKP_07.Texture = "rbxassetid://232918622"
		SKP_07.TextureMode = Enum.TextureMode.Stretch
		SKP_07.LightEmission = 1
		SKP_07.Lifetime = 0.2
		SKP_07.FaceCamera = true
		SKP_07.Color = ColorSequence.new(SKP_arg8)
	end

	if SKP_arg10 then
	local SKP_08 = Instance.new("BillboardGui", SKP_02)
		SKP_08.Adornee = SKP_02
		local SKP_09 = math.random(375, 475)/10
		SKP_08.Size = UDim2.new(SKP_09, 0, SKP_09, 0)
		SKP_08.LightInfluence = 0
		local SKP_010 = Instance.new("ImageLabel", SKP_08)
		SKP_010.BackgroundTransparency = 1
		SKP_010.Size = UDim2.new(1, 0, 1, 0)
		SKP_010.Position = UDim2.new(0, 0, 0, 0)
		SKP_010.Image = "http://www.roblox.com/asset/?id=1047066405"
		SKP_010.ImageColor3 = SKP_arg11

		SKP_010.ImageTransparency = math.random(2, 5)/15

		if SKP_02:FindFirstChild("BillboardGui") ~= nil then
			SKP_02.BillboardGui.Enabled = true
		end
	end

	local SKP_011 = {SKP_arg1.Character,SKP_02,workspace.ACS_WorkSpace}
	while true do
		RS.Heartbeat:wait()
		local SKP_012 = Ray.new(SKP_02.Position, SKP_02.CFrame.LookVector*25)
		local SKP_013, SKP_014 = workspace:FindPartOnRayWithIgnoreList(SKP_012, SKP_011, false, true)
		if SKP_013 then
			game.Debris:AddItem(SKP_02,0)
			break
		end
	end
	game.Debris:AddItem(SKP_02,0)
	return SKP_02
end
end)

Human.StateChanged:connect(onStateChanged)

Evt.ACS_AI.AIBullet.OnClientEvent:Connect(function(SKP_arg1,SKP_arg3,SKP_arg4,SKP_arg5,SKP_arg6,SKP_arg7,SKP_arg8,SKP_arg9,SKP_arg10,SKP_arg11,SKP_arg12)
if SKP_arg1 ~= Jogador then
local SKP_01 = SKP_arg3
	local SKP_02 = Instance.new("Part")
	SKP_02.Parent = workspace.ACS_WorkSpace.Server
	SKP_02.Name = "AI_Bullet"
	Debris:AddItem(SKP_02, 5)
	SKP_02.Shape = "Ball"
	SKP_02.Size = Vector3.new(1, 1, 1)
	SKP_02.CanCollide = false
	SKP_02.CFrame = SKP_01
	SKP_02.Transparency = 1

	local SKP_03 = SKP_02:GetMass()
	local SKP_04 = Instance.new('BodyForce', SKP_02)

	SKP_04.Force = Vector3.new(0,SKP_03 * (196.2) - SKP_arg5 * (196.2), 0)
	SKP_02.Velocity = SKP_arg7 * SKP_arg6

	local SKP_05 = Instance.new('Attachment', SKP_02)
	SKP_05.Position = Vector3.new(0.1, 0, 0)
	local SKP_06 = Instance.new('Attachment', SKP_02)
	SKP_06.Position = Vector3.new(-0.1, 0, 0)

	if SKP_arg4 then
		local SKP_07 = Instance.new('Trail', SKP_02)
		SKP_07.Attachment0 = SKP_05
		SKP_07.Attachment1 = SKP_06
		SKP_07.Transparency = NumberSequence.new({
				NumberSequenceKeypoint.new(0, 0, 0);
				NumberSequenceKeypoint.new(1, 1);
			}
		)
		SKP_07.WidthScale = NumberSequence.new({
				NumberSequenceKeypoint.new(0, 2, 0);
				NumberSequenceKeypoint.new(1, 0);
			}
		)
		SKP_07.Texture = "rbxassetid://232918622"
		SKP_07.TextureMode = Enum.TextureMode.Stretch
		SKP_07.LightEmission = 1
		SKP_07.Lifetime = 0.2
		SKP_07.FaceCamera = true
		SKP_07.Color = ColorSequence.new(SKP_arg8)
	end

	if SKP_arg10 then
	local SKP_08 = Instance.new("BillboardGui", SKP_02)
		SKP_08.Adornee = SKP_02
		local SKP_09 = math.random(375, 475)/10
		SKP_08.Size = UDim2.new(SKP_09, 0, SKP_09, 0)
		SKP_08.LightInfluence = 0
		local SKP_010 = Instance.new("ImageLabel", SKP_08)
		SKP_010.BackgroundTransparency = 1
		SKP_010.Size = UDim2.new(1, 0, 1, 0)
		SKP_010.Position = UDim2.new(0, 0, 0, 0)
		SKP_010.Image = "http://www.roblox.com/asset/?id=1047066405"
		SKP_010.ImageColor3 = SKP_arg11

		SKP_010.ImageTransparency = math.random(2, 5)/15

		if SKP_02:FindFirstChild("BillboardGui") ~= nil then
			SKP_02.BillboardGui.Enabled = true
		end
	end

	local SKP_011 = {SKP_02,workspace.ACS_WorkSpace}
	while true do
		RS.Heartbeat:wait()
		local SKP_012 = Ray.new(SKP_02.Position, SKP_02.CFrame.LookVector*25)
		local SKP_013, SKP_014 = workspace:FindPartOnRayWithIgnoreList(SKP_012, SKP_011, false, true)
		if SKP_013 then
			game.Debris:AddItem(SKP_02,0)
			break
		end
	end
	game.Debris:AddItem(SKP_02,0)
	return SKP_02
end
end)

Evt.ACS_AI.AIShoot.OnClientEvent:Connect(function(Gun)

	for _, v in pairs(Gun.Muzzle:GetChildren()) do
				if v.Name:sub(1, 7) == "FlashFX" or v.Name:sub(1, 7) == "Smoke" then
					v.Enabled = true
					end
				end

		delay(1 / 30, function()

			for _, v in pairs(Gun.Muzzle:GetChildren()) do
				if v.Name:sub(1, 7) == "FlashFX" or v.Name:sub(1, 7) == "Smoke" then
					v.Enabled = false
				end
			end
		end)

end)


Prompt:
--[[for index, child in pairs(workspace.TexturePallete:GetChildren()) do
	if child:IsA("Part") then
		if child.BrickColor.Name == "Dark green" then
			game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.Grass)
		end
		if child.BrickColor.Name == "Dirt brown" then
			game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.Mud)
		end
		if child.BrickColor.Name == "Deep blue" then
			game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.Water)
		end
		if child.BrickColor.Name == "Pine Cone" then
			game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.WoodPlanks)
		end
		if child.BrickColor.Name == "Teal" then
			game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.Glacier)
		end
		if child.BrickColor.Name == "Really red" then
			game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.CrackedLava)
		end
		if child.BrickColor.Name == "Wheat" then
			game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.Concrete)
		end
		if child.BrickColor.Name == "Bronze" then
			game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.Sand)
		end
		if child.BrickColor.Name == "Smoky grey" then
			game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.Rock)
		end
		if child.BrickColor.Name == "Rust" then
			game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.Sandstone)
		end
		if child.BrickColor.Name == "Reddish brown" then
			game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.Ground)
		end
		if child.BrickColor.Name == "Fossil" then
			game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.Slate)
		end
		if child.BrickColor.Name == "Burgundy" then
			game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.Brick)
		end
		if child.BrickColor.Name == "White" then
			game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.Snow)
		end
		if child.BrickColor.Name == "Really black" then
			game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.Basalt)
		end
	end
    -- print(index, child.Name)
end]]


Response:
Displays = 3 -- Sets how many displays this scripts will use...
DisplayColor = Color3.fromRGB(85, 85, 255)


Prompt:
--local function UpdateIcon()
--	if Mouse then
--		Mouse.Icon = Tool.Enabled and MOUSE_ICON or RELOADING_ICON
--	end
--end


Response:
local Monster = {} -- Create the monster class

function Monster:GetCFrame()
	-- Returns the CFrame of the monster's humanoidrootpart

	local humanoidRootPart = Self:FindFirstChild('HumanoidRootPart')

	if humanoidRootPart ~= nil and humanoidRootPart:IsA('BasePart') then
		return humanoidRootPart.CFrame
	else
		return CFrame.new()
	end
end

function Monster:GetMaximumDetectionDistance()
	-- Returns the maximum detection distance

	local setting = Settings.MaximumDetectionDistance.Value

	if setting < 0 then
		return math.huge
	else
		return setting
	end
end

function Monster:SearchForTarget()
	-- Finds the closest player and sets the target

	local players = Info.Players:GetPlayers()
	local closestCharacter, closestCharacterDistance

	for i=1, #players do
		local player = players[i]

		if player.Neutral or player.TeamColor ~= Settings.FriendlyTeam.Value then
			local character = player.Character

			if character ~= nil and character:FindFirstChild('Humanoid') ~= nil and character.Humanoid:IsA('Humanoid') then
				local distance = player:DistanceFromCharacter(Monster:GetCFrame().p)

				if distance < Monster:GetMaximumDetectionDistance() then
					if closestCharacter == nil then
						closestCharacter, closestCharacterDistance = character, distance
					else
						if closestCharacterDistance > distance then
							closestCharacter, closestCharacterDistance = character, distance
						end
					end
				end
			end
		end
	end

	if closestCharacter ~= nil then
		Mind.CurrentTargetHumanoid.Value = closestCharacter.Humanoid
	end
end

function Monster:TryRecomputePath()
	if Data.AutoRecompute or tick() - Data.LastRecomputePath > 1/Info.RecomputePathFrequency then
		Monster:RecomputePath()
	end
end

function Monster:GetTargetCFrame()
	local targetHumanoid = Mind.CurrentTargetHumanoid.Value

	if Monster:TargetIsValid() then
		return targetHumanoid.Torso.CFrame
	else
		return CFrame.new()
	end
end

function Monster:IsAlive()
	return Self.Humanoid.Health > 0 and Self.Humanoid.Torso ~= nil
end

function Monster:TargetIsValid()
	local targetHumanoid = Mind.CurrentTargetHumanoid.Value

	if targetHumanoid ~= nil and targetHumanoid:IsA 'Humanoid' and targetHumanoid.Torso ~= nil and targetHumanoid.Torso:IsA 'BasePart' then
		return true
	else
		return false
	end
end

function Monster:HasClearLineOfSight()
	-- Going to cast a ray to see if I can just see my target
	local myPos, targetPos = Monster:GetCFrame().p, Monster:GetTargetCFrame().p

	local hit, pos = Workspace:FindPartOnRayWithIgnoreList(
		Ray.new(
			myPos,
			targetPos - myPos
		),
		{
			Self,
			Mind.CurrentTargetHumanoid.Value.Parent
		}
	)

	if hit == nil then
		return true
	else
		return false
	end
end

function Monster:RecomputePath()
	if not Data.Recomputing then
		if Monster:IsAlive() and Monster:TargetIsValid() then
			if Monster:HasClearLineOfSight() then
				Data.AutoRecompute = true
				Data.PathCoords = {
					Monster:GetCFrame().p,
					Monster:GetTargetCFrame().p
				}

				Data.LastRecomputePath = tick()
				Data.CurrentNode = nil
				Data.CurrentNodeIndex = 2 -- Starts chasing the target without evaluating its current position
			else
				-- Do pathfinding since you can't walk straight
				Data.Recomputing = true -- Basically a debounce.
				Data.AutoRecompute = false

				local path = Info.PathfindingService:ComputeSmoothPathAsync(
					Monster:GetCFrame().p,
					Monster:GetTargetCFrame().p,
					500
				)
				Data.PathCoords = path:GetPointCoordinates()

				Data.Recomputing = false
				Data.LastRecomputePath = tick()
				Data.CurrentNode = nil
				Data.CurrentNodeIndex = 1
			end
		end
	end
end

function Monster:Update()
	Monster:ReevaluateTarget()
	Monster:SearchForTarget()
	Monster:TryRecomputePath()
	Monster:TravelPath()
end

function Monster:TravelPath()
	local closest, closestDistance, closestIndex
	local myPosition = Monster:GetCFrame().p
	local skipCurrentNode = Data.CurrentNode ~= nil and (Data.CurrentNode - myPosition).magnitude < 3

	for i=Data.CurrentNodeIndex, #Data.PathCoords do
		local coord = Data.PathCoords[i]
		if not (skipCurrentNode and coord == Data.CurrentNode) then
			local distance = (coord - myPosition).magnitude

			if closest == nil then
				closest, closestDistance, closestIndex = coord, distance, i
			else
				if distance < closestDistance then
					closest, closestDistance, closestIndex = coord, distance, i
				else
					break
				end
			end
		end
	end

	--
	if closest ~= nil then
		Data.CurrentNode = closest
		Data.CurrentNodeIndex = closestIndex

		local humanoid = Self:FindFirstChild 'Humanoid'

		if humanoid ~= nil and humanoid:IsA'Humanoid' then
			humanoid:MoveTo(closest)
		end

		if Monster:IsAlive() and Monster:TargetIsValid() then
			Monster:TryJumpCheck()
			Monster:TryAttack()
		end

		if closestIndex == #Data.PathCoords then
			-- Reached the end of the path, force a new check
			Data.AutoRecompute = true
		end
	end
end

function Monster:TryJumpCheck()
	if tick() - Data.LastJumpCheck > 1/Info.JumpCheckFrequency then
		Monster:JumpCheck()
	end
end

function Monster:TryAttack()
	if tick() - Data.LastAttack > 1/Settings.AttackFrequency.Value then
		Monster:Attack()
	end
end

function Monster:Attack()
	local myPos, targetPos = Monster:GetCFrame().p, Monster:GetTargetCFrame().p

	if (myPos - targetPos).magnitude <= Settings.AttackRange.Value then
		Mind.CurrentTargetHumanoid.Value:TakeDamage(Settings.AttackDamage.Value)
		Data.LastAttack = tick()
		Data.AttackTrack:Play()
	end
end

function Monster:JumpCheck()
	-- Do a raycast to check if we need to jump
	local myCFrame = Monster:GetCFrame()
	local checkVector = (Monster:GetTargetCFrame().p - myCFrame.p).unit*2

	local hit, pos = Workspace:FindPartOnRay(
		Ray.new(
			myCFrame.p + Vector3.new(0, -2.4, 0),
			checkVector
		),
		Self
	)

	if hit ~= nil and not hit:IsDescendantOf(Mind.CurrentTargetHumanoid.Value.Parent) then
		-- Do a slope check to make sure we're not walking up a ramp

		local hit2, pos2 = Workspace:FindPartOnRay(
			Ray.new(
				myCFrame.p + Vector3.new(0, -2.3, 0),
				checkVector
			),
			Self
		)

		if hit2 == hit then
			if ((pos2 - pos)*Vector3.new(1,0,1)).magnitude < 0.05 then -- Will pass for any ramp with <2 slope
				Self.Humanoid.Jump = true
			end
		end
	end

	Data.LastJumpCheck = tick()
end

function Monster:Connect()
	Mind.CurrentTargetHumanoid.Changed:connect(function(humanoid)
		if humanoid ~= nil then
			assert(humanoid:IsA'Humanoid', 'Monster target must be a humanoid')

			Monster:RecomputePath()
		end
	end)

	Self.Respawn.OnInvoke = function(point)
		Monster:Respawn(point)
	end
end

function Monster:Initialize()
	Monster:Connect()

	if Settings.AutoDetectSpawnPoint.Value then
		Settings.SpawnPoint.Value = Monster:GetCFrame().p
	end
end

function Monster:Respawn(point)
	local point = point or Settings.SpawnPoint.Value

	for index, obj in next, Data.BaseMonster:Clone():GetChildren() do
		if obj.Name == 'Configurations' or obj.Name == 'Mind' or obj.Name == 'Respawned' or obj.Name == 'Died' or obj.Name == 'MonsterScript' or obj.Name == 'Respawn' then
			obj:Destroy()
		else
			Self[obj.Name]:Destroy()
			obj.Parent = Self
		end
	end

	Monster:InitializeUnique()

	Self.Parent = Workspace

	Self.HumanoidRootPart.CFrame = CFrame.new(point)
	Settings.SpawnPoint.Value = point
	Self.Respawned:Fire()
end

function Monster:InitializeUnique()
	Data.AttackTrack = Self.Humanoid:LoadAnimation(script.Attack)
end

function Monster:ReevaluateTarget()
	local currentTarget = Mind.CurrentTargetHumanoid.Value

	if currentTarget ~= nil and currentTarget:IsA'Humanoid' then
		local character = currentTarget.Parent

		if character ~= nil then
			local player = Info.Players:GetPlayerFromCharacter(character)

			if player ~= nil then
				if not player.Neutral and player.TeamColor == Settings.FriendlyTeam.Value then
					Mind.CurrentTargetHumanoid.Value = nil
				end
			end
		end

		if currentTarget == Mind.CurrentTargetHumanoid.Value then
			local torso = currentTarget.Torso

			if torso ~= nil and torso:IsA 'BasePart' then
				if Settings.CanGiveUp.Value and (torso.Position - Monster:GetCFrame().p).magnitude > Monster:GetMaximumDetectionDistance() then
					Mind.CurrentTargetHumanoid.Value = nil
				end
			end
		end
	end
end


Prompt: -- So if you used your script & when you click "q" & release it, the Animation instance that's loaded in your Humanoid will be created 2 times, since you loaded it twice (through your .KeyDown/.KeyUp functions).


Prompt:
--to do
--go towards boxes
--account for arrows and paladins
--account for boss size

Response:
local MoveDirections = {Vector3.new(5,0,0),Vector3.new(-5,0,0),Vector3.new(0,0,5),Vector3.new(0,0,-5)}
local GasDirections = {Vector3.new(5,0,0),Vector3.new(-5,0,0),Vector3.new(0,0,5),Vector3.new(0,0,-5),Vector3.new(5,0,5),Vector3.new(-5,0,5),Vector3.new(5,0,5),Vector3.new(5,0,-5)}

return function(Map)
	local Pathfinding = require(game.ReplicatedStorage.PathfindFunctions)(Map)
	local Movement = require(game.ReplicatedStorage.EnemyAi.Movement)(Map)
	local Self = {}
	local ExploredPositions = {}
	local OutsidePositions = {}

	Self.CheckSquare = function(Position)
		if table.find(Map,Vector3.new(Position.X, 0, Position.Z)) then
			return true
		end
		return false
	end

	Self.GetDangerSpots = function(Enemies)
		local Spots = {}
		for i, Enemy in pairs (Enemies) do
			if Enemy.IsAttacking then
				for i, v in pairs(MoveDirections) do
					table.insert(Spots, Enemy.Position - Vector3.new(0, Enemy.Position.Y) + v)
				end
			end
		end
		for i, Projectile in pairs(workspace.ActiveProjectiles:GetChildren()) do
			local NewPos = Projectile.PrimaryPart.Position + Projectile.MoveDirection.Value
			local FlooredSpot = Vector3.new(math.floor(NewPos.X/5)*5, 0,math.floor(NewPos.Z/5)*5)
			table.insert(Spots, FlooredSpot)

		end
		for i, Trap in pairs(workspace.ActiveTraps:GetChildren()) do
			table.insert(Spots, Trap.PrimaryPart.Position)
			if Trap.PrimaryPart.Size.X >= 12 then
				for i, v in pairs(GasDirections) do
					table.insert(Spots, Trap.PrimaryPart.Position + v)
				end
			end
		end
		return Spots
	end

	Self.GetAttackersOfSpot = function(Position)
		local Attackers = {}
		for i, Model in pairs(workspace.ActiveEnemies:GetChildren()) do
			if (Model.PrimaryPart.Position - Position).Magnitude <= 7 then
				table.insert(Attackers, Model)
			end
		end
		return Attackers
	end

	Self.GetEnemies = function()
		local EnemyTable = {}
		for i ,v in pairs(workspace.ActiveEnemies:GetChildren()) do
			local SpotData = {}
			SpotData.Position = v.PrimaryPart.Position
			SpotData.IsAttacking = v.PrimaryPart.BrickColor == BrickColor.new("Really red")
			table.insert(EnemyTable, SpotData)
		end
		return EnemyTable
	end

	Self.GetEnemyAtPosition = function(Position, EnemyTable)
		for i, v in pairs(EnemyTable) do
			if Vector3.new(v.Position.X, 0, v.Position.Z) == Vector3.new(Position.X, 0, Position.Z) then
				return v
			end
		end
		return false
	end

	Self.CheckIfDangerSpot = function(Position, DangerSpots)
		for i, v in pairs(DangerSpots) do
			if Vector3.new(v.X, 0, v.Z) == Vector3.new(Position.X, 0, Position.Z) then
				return v
			end
		end
		return false
	end

	Self.GetBestCostingSpot = function(Spots)
		local BestCost = -math.huge
		local BestSpots = {}
		for i, v in pairs(Spots) do
			if v.Cost > BestCost then
				BestCost = v.Cost
				BestSpots = {}
				table.insert(BestSpots, v)
			elseif v.Cost == BestCost then
				table.insert(BestSpots, v)
			end

		end
		return BestSpots[math.random(1, #BestSpots)]
	end

	Self.PositionReachedAmount = function(Position)
		local Amount = 0
		for i, v in pairs(ExploredPositions) do
			if Vector3.new(v.X, 0, v.Z) == Position - Vector3.new(Position.Y) then
				Amount += 1
			end
		end
		return Amount
	end

	Self.UpdateEnemies = function(EnemyTable)
		local NewTable = {}
		for i, v in pairs(EnemyTable) do
			if v.IsAttacking then
				local MoveDirection = Movement.GetNearestPlayerDirection(v.Position, false, false, nil, true)
				local NewData = {}
				NewData.Position = v.Position + MoveDirection
				-- you could check but this is the lazy way
				NewData.IsAttacking = true
			end
		end
		return NewTable
	end

	Self.GetOutsideSquares = function()
		local Squares = {}
		for i, Spot in pairs(Map) do
			for i, v in pairs(MoveDirections) do
				if not Self.CheckSquare(Spot+v) then
					table.insert(Squares, Spot)
					break
				end
			end
		end
		OutsidePositions = Squares
	end

	Self.IsOutsideSquare = function(Position, Squares)
		if table.find(OutsidePositions, Vector3.new(Position.X,0,Position.Z)) then
			return true
		else
			return false
		end
	end

	Self.GetMoveInfo = function(EnemyTable, Depth, playerPos, SentDirections)
		local Spots = {}
		local PlayerPos = playerPos
		local DangerSpots = Self.GetDangerSpots(EnemyTable)
		local Loot = workspace.Loot:GetChildren()
		local Closestloot  = nil
		local LootPos = nil
		local ClosestLootDistance = math.huge
		if #Loot~=0 then
			for i, v in pairs(workspace.Loot:GetChildren()) do
				local Distance = (v.PrimaryPart.Position - PlayerPos).Magnitude
				if Distance < ClosestLootDistance then
					Closestloot = v
					ClosestLootDistance= Distance
				end
			end
			LootPos = Closestloot.PrimaryPart.Position
		end

		local NewPos
		for i, v in pairs(MoveDirections) do
			DangerSpots = Self.GetDangerSpots(EnemyTable)
			--PlayerPos = game.Players.LocalPlayer.Character.PrimaryPart.Position

			local OriginPos = PlayerPos
			local AttackDirection = OriginPos + v

			--something wrong

			NewPos = (not Self.CheckSquare(AttackDirection) or Self.GetEnemyAtPosition(AttackDirection, EnemyTable))and OriginPos or AttackDirection

			local Directions
			if SentDirections then
				Directions = SentDirections
				table.remove(Directions, 1)
			end

			local Directions = (not SentDirections and LootPos) and Pathfinding.GetDirections(PlayerPos, LootPos)

			-- could check if there are still boxes

			local IsDangerous = Self.CheckIfDangerSpot(NewPos, DangerSpots)
			local Enemy = Self.GetEnemyAtPosition(AttackDirection, EnemyTable)
			local TimesPositionReached = Self.PositionReachedAmount(NewPos)
			local HasLoot = Closestloot and (Closestloot.PrimaryPart.Position - NewPos).Magnitude<3
			local IsOutsideSquare = Self.IsOutsideSquare(NewPos)
			local IsDirectionOfCrate = Directions and Directions[1] == v

			-- make it realize that an enemy dies when it's attacked at 0 health
			-- make this account for paladins
			local AttackersOfPlayerSpot = Self.GetAttackersOfSpot(PlayerPos)
			local CanAttackThoughRed = #AttackersOfPlayerSpot== 1 and AttackersOfPlayerSpot[1].Health.Value == 1 and AttackersOfPlayerSpot[1].PrimaryPart.Position == AttackDirection + Vector3.new(0, -AttackDirection.Y + AttackersOfPlayerSpot[1].PrimaryPart.Position.Y)
			local Cost = (IsDangerous and not CanAttackThoughRed) and-10 or 0
			Cost += TimesPositionReached*-0.1
			Cost += IsOutsideSquare and -1 or 0
			Cost += (Enemy and not IsDangerous) and 2 or 0
			Cost += CanAttackThoughRed and 2 or 0
			Cost += IsDirectionOfCrate and 4 or 0
			Cost += HasLoot and 4 or 0

			if Depth>0 then
				Cost += Self.GetMoveInfo(Self.UpdateEnemies(EnemyTable), Depth-1, PlayerPos + v, Directions).Cost
			end

			local Data = {}
			Data.Direction = v
			Data.Cost = Cost
			table.insert(Spots, Data)
		end

		local BestSpot = Self.GetBestCostingSpot(Spots)

		table.insert(ExploredPositions, PlayerPos)

		return BestSpot
	end

	Self.MovePlayer = function()
		local PlayerPos = game.Players.LocalPlayer.Character.PrimaryPart.Position
		PlayerPos = Vector3.new(math.floor(PlayerPos.X + 0.5), 0, math.floor(PlayerPos.Z + 0.5))
		Self.GetOutsideSquares()
		local MoveInfo = Self.GetMoveInfo(Self.GetEnemies(), 0, PlayerPos)
		game.ReplicatedStorage.Events.Move:FireServer(MoveInfo.Direction.Unit)

	end

	return Self
end


Prompt:
--[=[
	@within TableUtil
	@function Map
	@param tbl table
	@param predicate (value: any, key: any, tbl: table) -> newValue: any
	@return table

	Performs a map operation against the given table, which can be used to
	map new values based on the old values at given keys/indices.

	For example:

	```lua
	local t = {A = 10, B = 20, C = 30}
	local t2 = TableUtil.Map(t, function(value)
		return value * 2
	end)
	print(t2) --> {A = 20, B = 40, C = 60}
	```
]=]

Response:
local function Map<T, M>(t: { T }, f: (T, number, { T }) -> M): { M }
	assert(type(t) == "table", "First argument must be a table")
	assert(type(f) == "function", "Second argument must be a function")
	local newT = table.create(#t)
	for k, v in t do
		newT[k] = f(v, k, t)
	end
	return newT
end


Prompt: --- Flash text color (good for visually showing updates to text)

Response:
return function(textLabel, speed)
	--- Variables
	speed = speed or 1

	--- Cache original text color (or grab it)
	local originalTextColor = _L.GUIFX.CacheProperty(textLabel, "TextColor3")

	--- Change to 'flashed' text
	if originalTextColor == Color3.new(1, 1, 1) then
		--- Half text color saturation
		textLabel.TextColor3 = Color3.new(
			originalTextColor.r / 2,
			originalTextColor.g / 2,
			originalTextColor.b / 2
		)
	else
		--- Double text color saturation
		textLabel.TextColor3 = Color3.new(
			originalTextColor.r * 2,
			originalTextColor.g * 2,
			originalTextColor.b * 2
		)
	end

	--- Revert (fade in)
	local tween = _L.Functions.FastTween(textLabel, {TextColor3 = originalTextColor}, {speed, EasingStyle})
end


Prompt: -- Function to handle key input

Response:
local function handleKeyPress(input, gameProcessedEvent)
	if not gameProcessedEvent and input.KeyCode == Enum.KeyCode.LeftShift then
		setWalkspeed(desiredWalkspeed)
	end
end


Prompt:
--[=[
	@class Keyboard
	@client

	The Keyboard class is part of the Input package.

	```lua
	local Keyboard = require(packages.Input).Keyboard
	```
]=]

Response:
local Keyboard = {}
Keyboard.__index = Keyboard


Prompt: --------------------) Settings

Response:
Damage = 0 -- the ammout of health the player or mob will take

Cooldown = 5 -- cooldown for use of the tool again

ZoneModelName = "Red ring" -- name the zone model

MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage


Prompt: ----[FIRE FUNCTIONS WHEN PLUGIN SIZE CHANGES]----

Response:
local function PluginChanged()
	ResizeSlider()
end
PluginGui.Changed:Connect(PluginChanged)


Prompt:
-- TableUtil
-- Stephen Leitnick
-- September 13, 2017

Response:
type Table = {any}
type MapPredicate = (any, any, Table) -> any
type FilterPredicate = (any, any, Table) -> boolean
type ReducePredicate = (any, any, any, Table) -> any
type FindCallback = (any, any, Table) -> boolean
type IteratorFunc = (t: Table, k: any) -> (any, any)


Response:
	,FastReload = false					--- Automatically operates the bolt on reload if needed
	,SlideLock = false
	,MoveBolt = false
	,BoltLock = false
	,CanBreachDoor = false
	,CanBreak = false					--- Weapon can jam?
	,JamChance = 1000					--- This old piece of brick doesn't work fine >;c
	,IncludeChamberedBullet = false		--- Include the chambered bullet on next reload
	,Chambered = false					--- Start with the gun chambered?
	,LauncherReady = false				--- Start with the GL ready?
	,CanCheckMag = false					--- You can check the magazine
	,ArcadeMode = false					--- You can see the bullets left in magazine
	,RainbowMode = false				--- Operation: Party Time xD
	,ModoTreino = false					--- Surrender enemies instead of killing them
	,GunSize = 6.5
	,GunFOVReduction = 5.5

	,BoltExtend = Vector3.new(0, 0, 0.4)
	,SlideExtend = Vector3.new(0, 0, 0.4)


Prompt: -- initialize to idle

Response:
playAnimation("idle", 0.1, zombie)
pose = "Standing"


Response:
ItemID = 97569329 -- The ID of the Gamepass/T-Shirt.
OpenTime = 0 -- The time the door is open for.
OpenTrans = 1 -- The transparency of the door when it is open.
CloseTrans = 1 -- The transparency of the door when it is closed.
BuyGUI = true -- Set to false to stop the BuyGUI appearing.
KillOnTouch = false -- Set to false to stop players being killed when they touch it.


Prompt: -- create a basic loading gui

Response:
local screenGui = Instance.new("ScreenGui")
local textLabel = Instance.new("TextLabel", screenGui)
textLabel.Text = "Loading"
textLabel.Position = UDim2.new(0.5, 0, 0.5, 0)
textLabel.AnchorPoint = Vector2.new(0.5, 0.5)
textLabel.Size = UDim2.new(1 , 0, 1, 100) -- make sure the topbar is covered
textLabel.FontSize = Enum.FontSize.Size14
screenGui.Parent = playerGui


Prompt:
-- TaskQueue
-- Stephen Leitnick
-- November 20, 2021


Prompt: --[[Controls]]

Response:
	local _CTRL = _Tune.Controls
	local Controls = Instance.new("Folder",script.Parent)
	Controls.Name = "Controls"
	for i,v in pairs(_CTRL) do
		local a=Instance.new("StringValue",Controls)
		a.Name=i
		a.Value=v.Name
		a.Changed:connect(function()
			if i=="MouseThrottle" or i=="MouseBrake" then
				if a.Value == "MouseButton1" or a.Value == "MouseButton2" then
					_CTRL[i]=Enum.UserInputType[a.Value]
				else
					_CTRL[i]=Enum.KeyCode[a.Value]
				end
			else
				_CTRL[i]=Enum.KeyCode[a.Value]
			end
		end)
	end

	--Deadzone Adjust
	local _PPH = _Tune.Peripherals
		for i,v in pairs(_PPH) do
		local a = Instance.new("IntValue",Controls)
		a.Name = i
		a.Value = v
		a.Changed:connect(function()
			a.Value=math.min(100,math.max(0,a.Value))
			_PPH[i] = a.Value
		end)
	end

	--Input Handler
	function DealWithInput(input,IsRobloxFunction)
		if (UserInputService:GetFocusedTextBox()==nil) and not _InControls then --Ignore when UI Focus
			--Shift Down [Manual Transmission]
			if _IsOn and  (input.KeyCode ==_CTRL["ContlrShiftDown"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftDown"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftDown"])) and (_TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then
				if _CGear == 0 and (_TMode=="Auto" or not _ClPressing) then _ClutchOn = true end
				_CGear = math.max(_CGear-1,-1)

			--Shift Up [Manual Transmission]
			elseif _IsOn and  (input.KeyCode ==_CTRL["ContlrShiftUp"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftUp"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftUp"])) and (_TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then
				if _CGear == 0 and (_TMode=="Auto" or not _ClPressing) then _ClutchOn = true end
				_CGear = math.min(_CGear+1,#_Tune.Ratios-2)

			--Toggle Clutch
			elseif _IsOn and  (input.KeyCode ==_CTRL["ContlrClutch"] or (_MSteer and input.KeyCode==_CTRL["MouseClutch"]) or ((not _MSteer) and input.KeyCode==_CTRL["Clutch"])) and _TMode=="Manual" then
				if input.UserInputState == Enum.UserInputState.Begin then
					_ClutchOn = false
					_ClPressing = true
				elseif input.UserInputState == Enum.UserInputState.End then
					_ClutchOn = true
					_ClPressing = false
				end

			--Toggle PBrake
			elseif _IsOn and  input.KeyCode ==_CTRL["ContlrPBrake"] or (_MSteer and input.KeyCode==_CTRL["MousePBrake"]) or ((not _MSteer) and input.KeyCode==_CTRL["PBrake"]) then
				if input.UserInputState == Enum.UserInputState.Begin then
					_PBrake = not _PBrake
				elseif input.UserInputState == Enum.UserInputState.End then
					if car.DriveSeat.Velocity.Magnitude>5 then
						_PBrake = false
					end
				end

			--Toggle Transmission Mode
			elseif (input.KeyCode == _CTRL["ContlrToggleTMode"] or input.KeyCode==_CTRL["ToggleTransMode"]) and input.UserInputState == Enum.UserInputState.Begin then
				local n=1
				for i,v in pairs(_Tune.TransModes) do
					if v==_TMode then n=i break end
				end
				n=n+1
				if n>#_Tune.TransModes then n=1 end
				_TMode = _Tune.TransModes[n]

			--Throttle
			elseif _IsOn and ((not _MSteer) and (input.KeyCode==_CTRL["Throttle"] or input.KeyCode == _CTRL["Throttle2"])) or ((((_CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseThrottle"]) or input.KeyCode == _CTRL["MouseThrottle"])and _MSteer) then
				if input.UserInputState == Enum.UserInputState.Begin then
					_GThrot = 1
				else
					_GThrot = _Tune.IdleThrottle/100
				end

			--Brake
			elseif ((not _MSteer) and (input.KeyCode==_CTRL["Brake"] or input.KeyCode == _CTRL["Brake2"])) or ((((_CTRL["MouseBrake"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseBrake"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseBrake"]) or input.KeyCode == _CTRL["MouseBrake"])and _MSteer) then
				if input.UserInputState == Enum.UserInputState.Begin then
					_GBrake = 1
					car.Body.TL.BRAKE.Enabled = true
				else
					_GBrake = 0
					car.Body.TL.BRAKE.Enabled = false
				end

			--Steer Left
			elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerLeft"] or input.KeyCode == _CTRL["SteerLeft2"]) then
				if input.UserInputState == Enum.UserInputState.Begin then
					_GSteerT = -1
					_SteerL = true
				else
					if _SteerR then
						_GSteerT = 1
					else
						_GSteerT = 0
					end
					_SteerL = false
				end

			--Steer Right
			elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerRight"] or input.KeyCode == _CTRL["SteerRight2"]) then
				if input.UserInputState == Enum.UserInputState.Begin then
					_GSteerT = 1
					_SteerR = true
				else
					if _SteerL then
						_GSteerT = -1
					else
						_GSteerT = 0
					end
					_SteerR = false
				end

			--Toggle Mouse Controls
			elseif input.KeyCode ==_CTRL["ToggleMouseDrive"] then
				if input.UserInputState == Enum.UserInputState.End then
					_MSteer = not _MSteer
					_GThrot = _Tune.IdleThrottle/100
					_GBrake = 0
					_GSteerT = 0
					_ClutchOn = true
				end

			--Toggle TCS
			elseif  _Tune.TCSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleTCS"] or input.KeyCode == _CTRL["ContlrToggleTCS"] then
				if input.UserInputState == Enum.UserInputState.End then
					_TCS = not _TCS
				end

			--Toggle ABS
			elseif  _Tune. ABSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleABS"] or input.KeyCode == _CTRL["ContlrToggleABS"] then
				if input.UserInputState == Enum.UserInputState.End then
					_ABS = not _ABS
				end
			end

			--Variable Controls
			if input.UserInputType.Name:find("Gamepad") then
				--Gamepad Steering
				if input.KeyCode == _CTRL["ContlrSteer"] then
					if input.Position.X>= 0 then
						local cDZone = math.min(.99,_Tune.Peripherals.ControlRDZone/100)
						if math.abs(input.Position.X)>cDZone then
							_GSteerT = (input.Position.X-cDZone)/(1-cDZone)
						else
							_GSteerT = 0
						end
					else
						local cDZone = math.min(.99,_Tune.Peripherals.ControlLDZone/100)
						if math.abs(input.Position.X)>cDZone then
							_GSteerT = (input.Position.X+cDZone)/(1-cDZone)
						else
							_GSteerT = 0
						end
					end

				--Gamepad Throttle
				elseif _IsOn and input.KeyCode == _CTRL["ContlrThrottle"] then
					_GThrot = math.max(_Tune.IdleThrottle/100,input.Position.Z)

				--Gamepad Brake
				elseif input.KeyCode == _CTRL["ContlrBrake"] then
					_GBrake = input.Position.Z
				end
			end
		else
			_GThrot = _Tune.IdleThrottle/100
			_GSteerT = 0
			_GBrake = 0
			if _CGear~=0 then _ClutchOn = true end
		end
	end
	UserInputService.InputBegan:connect(DealWithInput)
	UserInputService.InputChanged:connect(DealWithInput)
	UserInputService.InputEnded:connect(DealWithInput)


Prompt:
--
--local TwinService = game:GetService("TweenService")
--local AnimationHighLight = TweenInfo.new(3)
--local Info = {FillTransparency = 0}
--local Animka = TwinService:Create(HighLight, AnimationHighLight, Info )
--local char = script.Parent

Response:
local hum = char:WaitForChild("Humanoid")
local deathAnim = hum:LoadAnimation(script.DeathAnim)
hum.BreakJointsOnDeath = false
local dead = false


Prompt:
--[[
	Returns a 2x2 matrix of coefficients for a given damping ratio, speed and
	time step. These coefficients can then be multiplied with the position and
	velocity of an existing spring to find the new position and velocity values.

	Specifically, this function returns four numbers -  posPos, posVel, velPos,
	and velVel, in that order - which can be applied to position and velocity
	like so:

	local newPosition = oldPosition * posPos + oldVelocity * posVel
	local newVelocity = oldPosition * velPos + oldVelocity * velVel

	If a large number of springs with identical damping ratios and speeds are
	being updated with the same time step, then these coefficients can be used
	to update all of them at once.

	This function assumes the damping ratio, speed and time step are all >= 0,
	with the expectation that these values have been verified beforehand.
]]

Response:
local function springCoefficients(timeStep: number, damping: number, speed: number): (number, number, number, number)
	-- if time step or speed is 0, then the spring won't move, so an identity
	-- matrix can be returned early
	if timeStep == 0 or speed == 0 then
		return
			1, 0,
			0, 1
	end

	if damping > 1 then
		-- overdamped spring

		-- solutions to the characteristic equation
		-- z = -ζω ± Sqrt[ζ^2 - 1] ω

		local zRoot = math.sqrt(damping^2 - 1)

		local z1 = (-zRoot - damping)*speed
		local z2 = (zRoot - damping)*speed

		-- x[t] -> x0(e^(t z2) z1 - e^(t z1) z2)/(z1 - z2)
		--		 + v0(e^(t z1) - e^(t z2))/(z1 - z2)

		local zDivide = 1/(z1 - z2)

		local z1Exp = math.exp(timeStep * z1)
		local z2Exp = math.exp(timeStep * z2)

		local posPosCoef = (z2Exp * z1 - z1Exp * z2) * zDivide
		local posVelCoef = (z1Exp - z2Exp) * zDivide

		-- v[t] -> x0(z1 z2(-e^(t z1) + e^(t z2)))/(z1 - z2)
		--		 + v0(z1 e^(t z1) - z2 e^(t z2))/(z1 - z2)

		local velPosCoef = z1*z2 * (-z1Exp + z2Exp) * zDivide
		local velVelCoef = (z1*z1Exp - z2*z2Exp) * zDivide

		return
			posPosCoef, posVelCoef,
			velPosCoef, velVelCoef

	elseif damping == 1 then
		-- critically damped spring

		-- x[t] -> x0(e^-tω)(1+tω) + v0(e^-tω)t

		local timeStepSpeed = timeStep * speed
		local negSpeedExp = math.exp(-timeStepSpeed)

		local posPosCoef = negSpeedExp * (1 + timeStepSpeed)
		local posVelCoef = negSpeedExp * timeStep

		-- v[t] -> x0(t ω^2)(-e^-tω) + v0(1 - tω)(e^-tω)

		local velPosCoef = -negSpeedExp * (timeStep * speed*speed)
		local velVelCoef = negSpeedExp * (1 - timeStepSpeed)

		return
			posPosCoef, posVelCoef,
			velPosCoef, velVelCoef

	else
		-- underdamped spring

		-- factored out of the solutions to the characteristic equation, to make
		-- the math cleaner

		local alpha = math.sqrt(1 - damping^2) * speed

		-- x[t] -> x0(e^-tζω)(α Cos[tα] + ζω Sin[tα])/α
		--       + v0(e^-tζω)(Sin[tα])/α

		local negDampSpeedExp = math.exp(-timeStep * damping * speed)

		local sinAlpha = math.sin(timeStep*alpha)
		local alphaCosAlpha = alpha * math.cos(timeStep*alpha)
		local dampSpeedSinAlpha = damping*speed*sinAlpha

		local invAlpha = 1 / alpha

		local posPosCoef = negDampSpeedExp * (alphaCosAlpha + dampSpeedSinAlpha) * invAlpha
		local posVelCoef = negDampSpeedExp * sinAlpha * invAlpha

		-- v[t] -> x0(-e^-tζω)(α^2 + ζ^2 ω^2)(Sin[tα])/α
		--       + v0(e^-tζω)(α Cos[tα] - ζω Sin[tα])/α

		local velPosCoef = -negDampSpeedExp * (alpha*alpha + damping*damping * speed*speed) * sinAlpha * invAlpha
		local velVelCoef = negDampSpeedExp * (alphaCosAlpha - dampSpeedSinAlpha) * invAlpha

		return
			posPosCoef, posVelCoef,
			velPosCoef, velVelCoef
	end
end

return springCoefficients


Prompt:
--////////////////////////////// Methods
--//////////////////////////////////////

Response:
local function ShallowCopy(table)
	local copy = {}
	for i, v in pairs(table) do
		copy[i] = v
	end
	return copy
end

local methods = {}

local lazyEventNames =
{
    eDestroyed = true,
	eSaidMessage = true,
	eReceivedMessage = true,
	eReceivedUnfilteredMessage = true,
	eMessageDoneFiltering = true,
	eReceivedSystemMessage = true,
	eChannelJoined = true,
	eChannelLeft = true,
	eMuted = true,
	eUnmuted = true,
	eExtraDataUpdated = true,
	eMainChannelSet = true,
	eChannelNameColorUpdated = true,
}
local lazySignalNames =
{
	Destroyed = "eDestroyed",
	SaidMessage = "eSaidMessage",
	ReceivedMessage = "eReceivedMessage",
	ReceivedUnfilteredMessage = "eReceivedUnfilteredMessage",
    RecievedUnfilteredMessage = "eReceivedUnfilteredMessage", -- legacy mispelling
	MessageDoneFiltering = "eMessageDoneFiltering",
	ReceivedSystemMessage = "eReceivedSystemMessage",
	ChannelJoined = "eChannelJoined",
	ChannelLeft = "eChannelLeft",
	Muted = "eMuted",
	Unmuted = "eUnmuted",
	ExtraDataUpdated = "eExtraDataUpdated",
	MainChannelSet = "eMainChannelSet",
	ChannelNameColorUpdated = "eChannelNameColorUpdated"
}

methods.__index = function (self, k)
	local fromMethods = rawget(methods, k)
	if fromMethods then return fromMethods end

    if lazyEventNames[k] and not rawget(self, k) then
        rawset(self, k, Instance.new("BindableEvent"))
    end
    local lazySignalEventName = lazySignalNames[k]
    if lazySignalEventName and not rawget(self, k) then
        if not rawget(self, lazySignalEventName) then
            rawset(self, lazySignalEventName, Instance.new("BindableEvent"))
        end
        rawset(self, k, rawget(self, lazySignalEventName).Event)
    end
    return rawget(self, k)
end

function methods:LazyFire(eventName, ...)
	local createdEvent = rawget(self, eventName)
	if createdEvent then
		createdEvent:Fire(...)
	end
end

function methods:SayMessage(message, channelName, extraData)
	if self.ChatService:InternalDoProcessCommands(self.Name, message, channelName) then
		return
	end
	if not channelName then
		return
	end

	local channel = self.Channels[channelName:lower()]
	if not channel then
		return
	end

	local messageObj = channel:InternalPostMessage(self, message, extraData)
	if messageObj then
		pcall(function()
			self:LazyFire("eSaidMessage", messageObj, channelName)
		end)
	end

	return messageObj
end

function methods:JoinChannel(channelName)
	if (self.Channels[channelName:lower()]) then
		warn("Speaker is already in channel \"" .. channelName .. "\"")
		return
	end

	local channel = self.ChatService:GetChannel(channelName)
	if (not channel) then
		error("Channel \"" .. channelName .. "\" does not exist!")
	end

	self.Channels[channelName:lower()] = channel
	channel:InternalAddSpeaker(self)
	local success, err = pcall(function()
		self.eChannelJoined:Fire(channel.Name, channel:GetWelcomeMessageForSpeaker(self))
	end)
	if not success and err then
		print("Error joining channel: " ..err)
	end
end

function methods:LeaveChannel(channelName)
	if (not self.Channels[channelName:lower()]) then
		warn("Speaker is not in channel \"" .. channelName .. "\"")
		return
	end

	local channel = self.Channels[channelName:lower()]

	self.Channels[channelName:lower()] = nil
	channel:InternalRemoveSpeaker(self)
	local success, err = pcall(function()
		self:LazyFire("eChannelLeft", channel.Name)
		if self.PlayerObj then
			self.EventFolder.OnChannelLeft:FireClient(self.PlayerObj, channel.Name)
		end
	end)
	if not success and err then
		print("Error leaving channel: " ..err)
	end
end

function methods:IsInChannel(channelName)
	return (self.Channels[channelName:lower()] ~= nil)
end

function methods:GetChannelList()
	local list = {}
	for i, channel in pairs(self.Channels) do
		table.insert(list, channel.Name)
	end
	return list
end

function methods:SendMessage(message, channelName, fromSpeaker, extraData)
	local channel = self.Channels[channelName:lower()]
	if (channel) then
		channel:SendMessageToSpeaker(message, self.Name, fromSpeaker, extraData)

	elseif RunService:IsStudio() then
		warn(string.format("Speaker '%s' is not in channel '%s' and cannot receive a message in it.", self.Name, channelName))

	end
end

function methods:SendSystemMessage(message, channelName, extraData)
	local channel = self.Channels[channelName:lower()]
	if (channel) then
		channel:SendSystemMessageToSpeaker(message, self.Name, extraData)

	elseif RunService:IsStudio() then
		warn(string.format("Speaker '%s' is not in channel '%s' and cannot receive a system message in it.", self.Name, channelName))

	end
end

function methods:GetPlayer()
	return self.PlayerObj
end

function methods:GetNameForDisplay()
	if ChatSettings.PlayerDisplayNamesEnabled then
		local player = self:GetPlayer()

		if player then
			return player.DisplayName
		else
			return self.Name
		end
	else
		return self.Name
	end
end

function methods:SetExtraData(key, value)
	self.ExtraData[key] = value
	self:LazyFire("eExtraDataUpdated", key, value)
end

function methods:GetExtraData(key)
	return self.ExtraData[key]
end

function methods:SetMainChannel(channelName)
	local success, err = pcall(function()
		self:LazyFire("eMainChannelSet", channelName)
		if self.PlayerObj then
			self.EventFolder.OnMainChannelSet:FireClient(self.PlayerObj, channelName)
		end
	end)
	if not success and err then
		print("Error setting main channel: " ..err)
	end
end