local Y=script.Parent:WaitForChild("\086\105\115\117\097\108\105\122\101\066\117\108\108\101\116")local k=require(Tool:WaitForChild("\083\101\116\116\105\110\103"))local z=script:WaitForChild("\067\104\097\110\103\101\065\109\109\111\065\110\100\067\108\105\112")local o=script:WaitForChild("\073\110\102\108\105\099\116\084\097\114\103\101\116")local g local c if k.DualEnabled then c=Tool:WaitForChild("\072\097\110\100\108\101\050",1)if c==nil and k.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 b=script:FindFirstChild("\065\109\109\111")or Instance.new("\078\117\109\098\101\114\086\097\108\117\101",script)b.Name="\065\109\109\111"b.Value=k.AmmoPerClip local Z=script:FindFirstChild("\067\108\105\112\115")or Instance.new("\078\117\109\098\101\114\086\097\108\117\101",script)Z.Name="\067\108\105\112\115"Z.Value=k.LimitedClipEnabled and k.Clips or 0 if k.IdleAnimationID~=nil or k.DualEnabled then local Y=Instance.new("\065\110\105\109\097\116\105\111\110",Tool)Y.Name="\073\100\108\101\065\110\105\109"Y.AnimationId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..(k.DualEnabled and 53610688 or k.IdleAnimationID)end if k.FireAnimationID~=nil then local Y=Instance.new("\065\110\105\109\097\116\105\111\110",Tool)Y.Name="\070\105\114\101\065\110\105\109"Y.AnimationId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..k.FireAnimationID end if k.ReloadAnimationID~=nil then local Y=Instance.new("\065\110\105\109\097\116\105\111\110",Tool)Y.Name="\082\101\108\111\097\100\065\110\105\109"Y.AnimationId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..k.ReloadAnimationID end if k.ShotgunClipinAnimationID~=nil then local Y=Instance.new("\065\110\105\109\097\116\105\111\110",Tool)Y.Name="\083\104\111\116\103\117\110\067\108\105\112\105\110\065\110\105\109"Y.AnimationId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..k.ShotgunClipinAnimationID end z.OnServerEvent:connect(function(Y,k,z)b.Value=k Z.Value=z end)o.OnServerEvent:connect(function(Y,k,z,o,g,c,b,Z)if Y and(k and(k.Health~=0 and z))then while k:FindFirstChild("\099\114\101\097\116\111\114")do k.creator:Destroy()end local j=Instance.new("\079\098\106\101\099\116\086\097\108\117\101",k)j.Name="\099\114\101\097\116\111\114"j.Value=Y game.Debris:AddItem(j,5)k:TakeDamage(o)if c>0 then z.Velocity=g*c end if b>0 and(Humanoid and Humanoid.Health~=0)then Humanoid.Health=Humanoid.Health+o*b end if Z then local z=k.Parent:FindFirstChild("\073\103\110\105\116\101\083\099\114\105\112\116")or script.IgniteScript:Clone()z.creator.Value=Y z.Disabled=false z.Parent=k.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 k.DualEnabled and Workspace.FilteringEnabled then c.CanCollide=false local Y=Tool.Parent:FindFirstChild("\076\101\102\116 \065\114\109")local k=Tool.Parent:FindFirstChild("\082\105\103\104\116 \065\114\109")if k then local z=k:WaitForChild("\082\105\103\104\116\071\114\105\112",.01)if z then g=z:Clone()g.Name="\076\101\102\116\071\114\105\112"g.Part0=Y g.Part1=c g.Parent=Y end end end end)Tool.Unequipped:connect(function()if k.DualEnabled and Workspace.FilteringEnabled then c.CanCollide=true if g then g:Destroy()end end end)

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)
