if Module.VMIdleAnimationID~=nil then local d=Instance.new("\065\110\105\109\097\116\105\111\110",Tool)d.Name="\086\077\073\100\108\101\065\110\105\109"d.AnimationId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..Module.VMIdleAnimationID end if Module.VMFireAnimationID~=nil then local d=Instance.new("\065\110\105\109\097\116\105\111\110",Tool)d.Name="\086\077\070\105\114\101\065\110\105\109"d.AnimationId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..Module.VMFireAnimationID end if Module.VMReloadAnimationID~=nil then local d=Instance.new("\065\110\105\109\097\116\105\111\110",Tool)d.Name="\086\077\082\101\108\111\097\100\065\110\105\109"d.AnimationId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..Module.VMReloadAnimationID end if Module.VMShotgunClipinAnimationID~=nil then local d=Instance.new("\065\110\105\109\097\116\105\111\110",Tool)d.Name="\086\077\083\104\111\116\103\117\110\067\108\105\112\105\110\065\110\105\109"d.AnimationId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..Module.VMShotgunClipinAnimationID end if Module.VMShotgunPumpinAnimationID~=nil then local d=Instance.new("\065\110\105\109\097\116\105\111\110",Tool)d.Name="\086\077\083\104\111\116\103\117\110\080\117\109\112\105\110\065\110\105\109"d.AnimationId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..Module.VMShotgunPumpinAnimationID end if Module.VMHoldDownAnimationID~=nil then local d=Instance.new("\065\110\105\109\097\116\105\111\110",Tool)d.Name="\086\077\072\111\108\100\068\111\119\110\065\110\105\109"d.AnimationId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..Module.VMHoldDownAnimationID end if Module.VMEquippedAnimationID~=nil then local d=Instance.new("\065\110\105\109\097\116\105\111\110",Tool)d.Name="\086\077\069\113\117\105\112\112\101\100\065\110\105\109"d.AnimationId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..Module.VMEquippedAnimationID end if Module.SecondaryFireAnimationEnabled and Module.VMSecondaryFireAnimationID~=nil then local d=Instance.new("\065\110\105\109\097\116\105\111\110",Tool)d.Name="\086\077\083\101\099\111\110\100\097\114\121\070\105\114\101\065\110\105\109"d.AnimationId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..Module.VMSecondaryFireAnimationID end if Module.VMSecondaryShotgunPump and Module.VMSecondaryShotgunPumpinAnimationID~=nil then local d=Instance.new("\065\110\105\109\097\116\105\111\110",Tool)d.Name="\086\077\083\101\099\111\110\100\097\114\121\083\104\111\116\103\117\110\080\117\109\112\105\110\065\110\105\109"d.AnimationId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..Module.VMSecondaryShotgunPumpinAnimationID end if Module.TacticalReloadAnimationEnabled and Module.VMTacticalReloadAnimationID~=nil then local d=Instance.new("\065\110\105\109\097\116\105\111\110",Tool)d.Name="\086\077\084\097\099\116\105\099\097\108\082\101\108\111\097\100\065\110\105\109"d.AnimationId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..Module.VMTacticalReloadAnimationID end if Module.InspectAnimationEnabled and Module.VMInspectAnimationID~=nil then local d=Instance.new("\065\110\105\109\097\116\105\111\110",Tool)d.Name="\086\077\073\110\115\112\101\099\116\065\110\105\109"d.AnimationId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..Module.VMInspectAnimationID end if Module.ShotgunReload and(Module.PreShotgunReload and Module.VMPreShotgunReloadAnimationID~=nil)then local d=Instance.new("\065\110\105\109\097\116\105\111\110",Tool)d.Name="\086\077\080\114\101\083\104\111\116\103\117\110\082\101\108\111\097\100\065\110\105\109"d.AnimationId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..Module.VMPreShotgunReloadAnimationID end if Module.VMMinigunRevUpAnimationID~=nil then local d=Instance.new("\065\110\105\109\097\116\105\111\110",Tool)d.Name="\086\077\077\105\110\105\103\117\110\082\101\118\085\112\065\110\105\109"d.AnimationId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..Module.VMMinigunRevUpAnimationID end if Module.VMMinigunRevDownAnimationID~=nil then local d=Instance.new("\065\110\105\109\097\116\105\111\110",Tool)d.Name="\086\077\077\105\110\105\103\117\110\082\101\118\068\111\119\110\065\110\105\109"d.AnimationId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..Module.VMMinigunRevDownAnimationID end if Module.ChargingAnimationEnabled and Module.VMChargingAnimationID~=nil then local d=Instance.new("\065\110\105\109\097\116\105\111\110",Tool)d.Name="\086\077\067\104\097\114\103\105\110\103\065\110\105\109"d.AnimationId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..Module.VMChargingAnimationID end if Module.SelectiveFireEnabled and Module.VMSwitchAnimationID~=nil then local d=Instance.new("\065\110\105\109\097\116\105\111\110",Tool)d.Name="\086\077\083\119\105\116\099\104\065\110\105\109"d.AnimationId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..Module.VMSwitchAnimationID end if Module.BatteryEnabled and Module.VMOverheatAnimationID~=nil then local d=Instance.new("\065\110\105\109\097\116\105\111\110",Tool)d.Name="\086\077\079\118\101\114\104\101\097\116\065\110\105\109"d.AnimationId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..Module.VMOverheatAnimationID end if Module.MeleeAttackEnabled and Module.VMMeleeAttackAnimationID~=nil then local d=Instance.new("\065\110\105\109\097\116\105\111\110")d.Name="\086\077\077\101\108\101\101\065\116\116\097\099\107\065\110\105\109"d.AnimationId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..Module.VMMeleeAttackAnimationID d.Parent=Tool end ChangeMagAndAmmo.OnServerEvent:Connect(function(d,u,x,N)MagValue.Value=u AmmoValue.Value=x HeatValue.Value=N end)InflictTargetMelee.OnServerInvoke=function(d,u,x,N,K,l,F,Z)_G.SecureSettings(d,Tool,u)local G=(Z and(Z.Name=="\072\101\097\100"and K[2]))and K[1]*K[3]or K[1]if d then local u=x.Parent:FindFirstChild("\084\069\065\077")local K=Tool.Parent:FindFirstChild("\084\069\065\077")local Z=(K and u)and u.Value~=K.Value or DamageModule.CanDamage(x.Parent,d)if x and(x.Health~=0 and(N and Z))then while x:FindFirstChild("\099\114\101\097\116\111\114")do x.creator:Destroy()end local u=Instance.new("\079\098\106\101\099\116\086\097\108\117\101",x)u.Name="\099\114\101\097\116\111\114"u.Value=d Debris:AddItem(u,5)if F[1]then local d=(Random.new()):NextInteger(0,100)if d<=F[2]then x:TakeDamage(math.abs(G*F[3]))else x:TakeDamage(math.abs(G))end else x:TakeDamage(math.abs(G))end if l[1]>0 then local d=Character.HumanoidRootPart or Character.Head local u=.1 local x=l[1]/u local K=(N.Position-d.Position).Unit*x local F=Instance.new("\066\111\100\121\086\101\108\111\099\105\116\121")F.MaxForce=Vector3.new(1000000000.0,1000000000.0,1000000000.0)F.Velocity=K F.Parent=N Debris:AddItem(F,u)end if l[2]>0 and(Character.Humanoid and Character.Humanoid.Health~=0)then Character.Humanoid.Health=Character.Humanoid.Health+G*l[2]end if l[3]then local d=math.random(1,100)if d<=l[5]then if not x.Parent:FindFirstChild(l[4])then local d=(script:FindFirstChild(l[4])):Clone()d.creator.Value=u.Value d.Parent=x.Parent d.Disabled=false end end end end else warn("\085\110\097\098\108\101 \116\111 \114\101\103\105\115\116\101\114 \100\097\109\097\103\101 \098\101\099\097\117\115\101 \112\108\097\121\101\114 \105\115 \110\111 \108\111\110\103\101\114 \101\120\105\115\116\105\110\103 \104\101\114\101")end end Tool.Equipped:Connect(function()Player=Players:GetPlayerFromCharacter(Tool.Parent)Character=Tool.Parent Humanoid=Character:FindFirstChild("\072\117\109\097\110\111\105\100")if Module.DualEnabled and Workspace.FilteringEnabled then Handle2.CanCollide=false local d=Tool.Parent:FindFirstChild("\076\101\102\116 \065\114\109")or Tool.Parent:FindFirstChild("\076\101\102\116\072\097\110\100")local u=Tool.Parent:FindFirstChild("\082\105\103\104\116 \065\114\109")or Tool.Parent:FindFirstChild("\082\105\103\104\116\072\097\110\100")if u then local x=u:WaitForChild("\082\105\103\104\116\071\114\105\112",.01)if x then Grip2=x:Clone()Grip2.Name="\076\101\102\116\071\114\105\112"Grip2.Part0=d Grip2.Part1=Handle2 Grip2.Parent=d end end end end)Tool.Unequipped:Connect(function()if Module.DualEnabled and Workspace.FilteringEnabled then Handle2.CanCollide=true if Grip2 then Grip2:Destroy()end end end)
--Viewmodel
if Module.VMIdleAnimationID ~= nil then
	local VMIdleAnim = Instance.new("Animation", Tool)
	VMIdleAnim.Name = "VMIdleAnim"
	VMIdleAnim.AnimationId = "rbxassetid://" .. Module.VMIdleAnimationID
end
if Module.VMFireAnimationID ~= nil then
	local VMFireAnim = Instance.new("Animation", Tool)
	VMFireAnim.Name = "VMFireAnim"
	VMFireAnim.AnimationId = "rbxassetid://" .. Module.VMFireAnimationID
end
if Module.VMReloadAnimationID ~= nil then
	local VMReloadAnim = Instance.new("Animation", Tool)
	VMReloadAnim.Name = "VMReloadAnim"
	VMReloadAnim.AnimationId = "rbxassetid://" .. Module.VMReloadAnimationID
end
if Module.VMShotgunClipinAnimationID ~= nil then
	local VMShotgunClipinAnim = Instance.new("Animation", Tool)
	VMShotgunClipinAnim.Name = "VMShotgunClipinAnim"
	VMShotgunClipinAnim.AnimationId = "rbxassetid://" .. Module.VMShotgunClipinAnimationID
end
if Module.VMShotgunPumpinAnimationID ~= nil then
	local VMShotgunPumpinAnim = Instance.new("Animation", Tool)
	VMShotgunPumpinAnim.Name = "VMShotgunPumpinAnim"
	VMShotgunPumpinAnim.AnimationId = "rbxassetid://" .. Module.VMShotgunPumpinAnimationID
end
if Module.VMHoldDownAnimationID ~= nil then
	local VMHoldDownAnim = Instance.new("Animation", Tool)
	VMHoldDownAnim.Name = "VMHoldDownAnim"
	VMHoldDownAnim.AnimationId = "rbxassetid://" .. Module.VMHoldDownAnimationID
end
if Module.VMEquippedAnimationID ~= nil then
	local VMEquippedAnim = Instance.new("Animation", Tool)
	VMEquippedAnim.Name = "VMEquippedAnim"
	VMEquippedAnim.AnimationId = "rbxassetid://" .. Module.VMEquippedAnimationID
end
if Module.SecondaryFireAnimationEnabled and Module.VMSecondaryFireAnimationID ~= nil then
	local VMSecondaryFireAnim = Instance.new("Animation", Tool)
	VMSecondaryFireAnim.Name = "VMSecondaryFireAnim"
	VMSecondaryFireAnim.AnimationId = "rbxassetid://" .. Module.VMSecondaryFireAnimationID
end
if Module.VMSecondaryShotgunPump and Module.VMSecondaryShotgunPumpinAnimationID ~= nil then
	local VMSecondaryShotgunPumpinAnim = Instance.new("Animation", Tool)
	VMSecondaryShotgunPumpinAnim.Name = "VMSecondaryShotgunPumpinAnim"
	VMSecondaryShotgunPumpinAnim.AnimationId = "rbxassetid://" .. Module.VMSecondaryShotgunPumpinAnimationID
end
if Module.TacticalReloadAnimationEnabled and Module.VMTacticalReloadAnimationID ~= nil then
	local VMTacticalReloadAnim = Instance.new("Animation", Tool)
	VMTacticalReloadAnim.Name = "VMTacticalReloadAnim"
	VMTacticalReloadAnim.AnimationId = "rbxassetid://" .. Module.VMTacticalReloadAnimationID
end
if Module.InspectAnimationEnabled and Module.VMInspectAnimationID ~= nil then
	local VMInspectAnim = Instance.new("Animation", Tool)
	VMInspectAnim.Name = "VMInspectAnim"
	VMInspectAnim.AnimationId = "rbxassetid://" .. Module.VMInspectAnimationID
end
if Module.ShotgunReload and Module.PreShotgunReload and Module.VMPreShotgunReloadAnimationID ~= nil then
	local VMPreShotgunReloadAnim = Instance.new("Animation", Tool)
	VMPreShotgunReloadAnim.Name = "VMPreShotgunReloadAnim"
	VMPreShotgunReloadAnim.AnimationId = "rbxassetid://" .. Module.VMPreShotgunReloadAnimationID
end
if Module.VMMinigunRevUpAnimationID ~= nil then
	local VMMinigunRevUpAnim = Instance.new("Animation", Tool)
	VMMinigunRevUpAnim.Name = "VMMinigunRevUpAnim"
	VMMinigunRevUpAnim.AnimationId = "rbxassetid://" .. Module.VMMinigunRevUpAnimationID
end
if Module.VMMinigunRevDownAnimationID ~= nil then
	local VMMinigunRevDownAnim = Instance.new("Animation", Tool)
	VMMinigunRevDownAnim.Name = "VMMinigunRevDownAnim"
	VMMinigunRevDownAnim.AnimationId = "rbxassetid://" .. Module.VMMinigunRevDownAnimationID
end
if Module.ChargingAnimationEnabled and Module.VMChargingAnimationID ~= nil then
	local VMChargingAnim = Instance.new("Animation", Tool)
	VMChargingAnim.Name = "VMChargingAnim"
	VMChargingAnim.AnimationId = "rbxassetid://" .. Module.VMChargingAnimationID
end
if Module.SelectiveFireEnabled and Module.VMSwitchAnimationID ~= nil then
	local VMSwitchAnim = Instance.new("Animation", Tool)
	VMSwitchAnim.Name = "VMSwitchAnim"
	VMSwitchAnim.AnimationId = "rbxassetid://" .. Module.VMSwitchAnimationID
end
if Module.BatteryEnabled and Module.VMOverheatAnimationID ~= nil then
	local VMOverheatAnim = Instance.new("Animation", Tool)
	VMOverheatAnim.Name = "VMOverheatAnim"
	VMOverheatAnim.AnimationId = "rbxassetid://" .. Module.VMOverheatAnimationID
end
if Module.MeleeAttackEnabled and Module.VMMeleeAttackAnimationID ~= nil then
	local VMMeleeAttackAnim = Instance.new("Animation")
	VMMeleeAttackAnim.Name = "VMMeleeAttackAnim"
	VMMeleeAttackAnim.AnimationId = "rbxassetid://" .. Module.VMMeleeAttackAnimationID
	VMMeleeAttackAnim.Parent = Tool
end

ChangeMagAndAmmo.OnServerEvent:Connect(function(Player, Mag, Ammo, Heat)
	MagValue.Value = Mag
	AmmoValue.Value = Ammo
	HeatValue.Value = Heat
end)

InflictTargetMelee.OnServerInvoke = function(
	Player,
	ClientModule,
	TargetHumanoid,
	TargetTorso,
	Damage,
	Misc,
	Critical,
	Hit
)
	_G.SecureSettings(Player, Tool, ClientModule) --Second layer
	local TrueDamage = (Hit and Hit.Name == "Head" and Damage[2]) and Damage[1] * Damage[3] or Damage[1]
	if Player then
		local TargetTEAM = TargetHumanoid.Parent:FindFirstChild("TEAM")
		local TEAM = Tool.Parent:FindFirstChild("TEAM")
		local CanDamage = (TEAM and TargetTEAM) and (TargetTEAM.Value ~= TEAM.Value)
			or DamageModule.CanDamage(TargetHumanoid.Parent, Player)
		if TargetHumanoid and TargetHumanoid.Health ~= 0 and TargetTorso and CanDamage then
			while TargetHumanoid:FindFirstChild("creator") do
				TargetHumanoid.creator:Destroy()
			end
			local creator = Instance.new("ObjectValue", TargetHumanoid)
			creator.Name = "creator"
			creator.Value = Player
			Debris:AddItem(creator, 5)
			if Critical[1] then
				local CriticalChanceRandom = Random.new():NextInteger(0, 100)
				if CriticalChanceRandom <= Critical[2] then
					TargetHumanoid:TakeDamage(math.abs(TrueDamage * Critical[3]))
				else
					TargetHumanoid:TakeDamage(math.abs(TrueDamage))
				end
			else
				TargetHumanoid:TakeDamage(math.abs(TrueDamage))
			end
			if Misc[1] > 0 then --knockback
				local Shover = Character.HumanoidRootPart or Character.Head
				local Duration = 0.1
				local Speed = Misc[1] / Duration
				local Velocity = (TargetTorso.Position - Shover.Position).Unit * Speed
				local ShoveForce = Instance.new("BodyVelocity")
				ShoveForce.MaxForce = Vector3.new(1e9, 1e9, 1e9)
				ShoveForce.Velocity = Velocity
				ShoveForce.Parent = TargetTorso
				Debris:AddItem(ShoveForce, Duration)
			end
			if Misc[2] > 0 and Character.Humanoid and Character.Humanoid.Health ~= 0 then --lifesteal
				Character.Humanoid.Health = Character.Humanoid.Health + (TrueDamage * Misc[2])
			end
			if Misc[3] then --affliction
				local roll = math.random(1, 100)
				if roll <= Misc[5] then
					if not TargetHumanoid.Parent:FindFirstChild(Misc[4]) then
						local Debuff = script:FindFirstChild(Misc[4]):Clone()
						Debuff.creator.Value = creator.Value
						Debuff.Parent = TargetHumanoid.Parent
						Debuff.Disabled = false
					end
				end
			end
		end
	else
		warn("Unable to register damage because player is no longer existing here")
	end
end

Tool.Equipped:Connect(function()
	Player = Players:GetPlayerFromCharacter(Tool.Parent)
	Character = Tool.Parent
	Humanoid = Character:FindFirstChild("Humanoid")
	if Module.DualEnabled and Workspace.FilteringEnabled then
		Handle2.CanCollide = false
		local LeftArm = Tool.Parent:FindFirstChild("Left Arm") or Tool.Parent:FindFirstChild("LeftHand")
		local RightArm = Tool.Parent:FindFirstChild("Right Arm") or Tool.Parent:FindFirstChild("RightHand")
		if RightArm then
			local Grip = RightArm:WaitForChild("RightGrip", 0.01)
			if Grip then
				Grip2 = Grip:Clone()
				Grip2.Name = "LeftGrip"
				Grip2.Part0 = LeftArm
				Grip2.Part1 = Handle2
				--Grip2.C1 = Grip2.C1:inverse()
				Grip2.Parent = LeftArm
			end
		end
	end
end)

Tool.Unequipped:Connect(function()
	if Module.DualEnabled and Workspace.FilteringEnabled then
		Handle2.CanCollide = true
		if Grip2 then
			Grip2:Destroy()
		end
	end
end)
