local Z=script.Parent:WaitForChild("\086\105\115\117\097\108\105\122\101\066\117\108\108\101\116")local Q=require(Tool:WaitForChild("\083\101\116\116\105\110\103"))local A=script:WaitForChild("\067\104\097\110\103\101\065\109\109\111\065\110\100\067\108\105\112")local F=script:WaitForChild("\073\110\102\108\105\099\116\084\097\114\103\101\116")local b local q if Q.DualEnabled then q=Tool:WaitForChild("\072\097\110\100\108\101\050",1)if q==nil and Q.DualEnabled then error("\"\068\117\097\108\" \115\101\116\116\105\110\103 \105\115 \101\110\097\098\108\101\100 \098\117\116 \"\072\097\110\100\108\101\050\" \105\115 \109\105\115\115\105\110\103\033")end end local U=script:FindFirstChild("\065\109\109\111")or Instance.new("\078\117\109\098\101\114\086\097\108\117\101",script)U.Name="\065\109\109\111"U.Value=Q.AmmoPerClip local N=script:FindFirstChild("\067\108\105\112\115")or Instance.new("\078\117\109\098\101\114\086\097\108\117\101",script)N.Name="\067\108\105\112\115"N.Value=Q.LimitedClipEnabled and Q.Clips or 0 if Q.IdleAnimationID~=nil or Q.DualEnabled then local Z=Instance.new("\065\110\105\109\097\116\105\111\110",Tool)Z.Name="\073\100\108\101\065\110\105\109"Z.AnimationId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..(Q.DualEnabled and 53610688 or Q.IdleAnimationID)end if Q.FireAnimationID~=nil then local Z=Instance.new("\065\110\105\109\097\116\105\111\110",Tool)Z.Name="\070\105\114\101\065\110\105\109"Z.AnimationId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..Q.FireAnimationID end if Q.ReloadAnimationID~=nil then local Z=Instance.new("\065\110\105\109\097\116\105\111\110",Tool)Z.Name="\082\101\108\111\097\100\065\110\105\109"Z.AnimationId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..Q.ReloadAnimationID end if Q.ShotgunClipinAnimationID~=nil then local Z=Instance.new("\065\110\105\109\097\116\105\111\110",Tool)Z.Name="\083\104\111\116\103\117\110\067\108\105\112\105\110\065\110\105\109"Z.AnimationId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..Q.ShotgunClipinAnimationID end A.OnServerEvent:connect(function(Z,Q,A)U.Value=Q N.Value=A end)F.OnServerEvent:connect(function(Z,Q,A,F,b,q,U,N)if Z and(Q and(Q.Health~=0 and A))then while Q:FindFirstChild("\099\114\101\097\116\111\114")do Q.creator:Destroy()end local n=Instance.new("\079\098\106\101\099\116\086\097\108\117\101",Q)n.Name="\099\114\101\097\116\111\114"n.Value=Z game.Debris:AddItem(n,5)Q:TakeDamage(F)if q>0 then A.Velocity=b*q end if U>0 and(Humanoid and Humanoid.Health~=0)then Humanoid.Health=Humanoid.Health+F*U end if N then local A=Q.Parent:FindFirstChild("\073\103\110\105\116\101\083\099\114\105\112\116")or script.IgniteScript:Clone()A.creator.Value=Z A.Disabled=false A.Parent=Q.Parent end end end)Tool.Equipped:connect(function()Player=game.Players:GetPlayerFromCharacter(Tool.Parent)Character=Tool.Parent Humanoid=Character:FindFirstChild("\072\117\109\097\110\111\105\100")if Q.DualEnabled and Workspace.FilteringEnabled then q.CanCollide=false local Z=Tool.Parent:FindFirstChild("\076\101\102\116 \065\114\109")local Q=Tool.Parent:FindFirstChild("\082\105\103\104\116 \065\114\109")if Q then local A=Q:WaitForChild("\082\105\103\104\116\071\114\105\112",.01)if A then b=A:Clone()b.Name="\076\101\102\116\071\114\105\112"b.Part0=Z b.Part1=q b.Parent=Z end end end end)Tool.Unequipped:connect(function()if Q.DualEnabled and Workspace.FilteringEnabled then q.CanCollide=true if b then b:Destroy()end end end)
--local TEAM
local VisualizeBullet = script.Parent:WaitForChild("VisualizeBullet")
local Module = require(Tool:WaitForChild("Setting"))
local ChangeAmmoAndClip = script:WaitForChild("ChangeAmmoAndClip")
local InflictTarget = script:WaitForChild("InflictTarget")
local Grip2
local Handle2

if Module.DualEnabled then
	Handle2 = Tool:WaitForChild("Handle2", 1)
	if Handle2 == nil and Module.DualEnabled then
		error('"Dual" setting is enabled but "Handle2" is missing!')
	end
end

local AmmoValue = script:FindFirstChild("Ammo") or Instance.new("NumberValue", script)
AmmoValue.Name = "Ammo"
AmmoValue.Value = Module.AmmoPerClip
local ClipsValue = script:FindFirstChild("Clips") or Instance.new("NumberValue", script)
ClipsValue.Name = "Clips"
ClipsValue.Value = Module.LimitedClipEnabled and Module.Clips or 0

if Module.IdleAnimationID ~= nil or Module.DualEnabled then
	local IdleAnim = Instance.new("Animation", Tool)
	IdleAnim.Name = "IdleAnim"
	IdleAnim.AnimationId = "rbxassetid://" .. (Module.DualEnabled and 53610688 or Module.IdleAnimationID)
end
if Module.FireAnimationID ~= nil then
	local FireAnim = Instance.new("Animation", Tool)
	FireAnim.Name = "FireAnim"
	FireAnim.AnimationId = "rbxassetid://" .. Module.FireAnimationID
end
if Module.ReloadAnimationID ~= nil then
	local ReloadAnim = Instance.new("Animation", Tool)
	ReloadAnim.Name = "ReloadAnim"
	ReloadAnim.AnimationId = "rbxassetid://" .. Module.ReloadAnimationID
end
if Module.ShotgunClipinAnimationID ~= nil then
	local ShotgunClipinAnim = Instance.new("Animation", Tool)
	ShotgunClipinAnim.Name = "ShotgunClipinAnim"
	ShotgunClipinAnim.AnimationId = "rbxassetid://" .. Module.ShotgunClipinAnimationID
end

ChangeAmmoAndClip.OnServerEvent:connect(function(Player, Ammo, Clips)
	AmmoValue.Value = Ammo
	ClipsValue.Value = Clips
end)
InflictTarget.OnServerEvent:connect(
	function(Player, TargetHumanoid, TargetTorso, Damage, Direction, Knockback, Lifesteal, FlamingBullet)
		if Player and TargetHumanoid and TargetHumanoid.Health ~= 0 and TargetTorso then
			while TargetHumanoid:FindFirstChild("creator") do
				TargetHumanoid.creator:Destroy()
			end
			local creator = Instance.new("ObjectValue", TargetHumanoid)
			creator.Name = "creator"
			creator.Value = Player
			game.Debris:AddItem(creator, 5)
			TargetHumanoid:TakeDamage(Damage)
			if Knockback > 0 then
				TargetTorso.Velocity = Direction * Knockback
			end
			if Lifesteal > 0 and Humanoid and Humanoid.Health ~= 0 then
				Humanoid.Health = Humanoid.Health + (Damage * Lifesteal)
			end
			if FlamingBullet then
				local Debuff = TargetHumanoid.Parent:FindFirstChild("IgniteScript") or script.IgniteScript:Clone()
				Debuff.creator.Value = Player
				Debuff.Disabled = false
				Debuff.Parent = TargetHumanoid.Parent
			end
		end
	end
)

Tool.Equipped:connect(function()
	Player = game.Players:GetPlayerFromCharacter(Tool.Parent)
	Character = Tool.Parent
	Humanoid = Character:FindFirstChild("Humanoid")
	--TEAM = Character:FindFirstChild("TEAM")
	if Module.DualEnabled and Workspace.FilteringEnabled then
		Handle2.CanCollide = false
		local LeftArm = Tool.Parent:FindFirstChild("Left Arm")
		local RightArm = Tool.Parent:FindFirstChild("Right Arm")
		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)
