wait(math.random(0,20)/40)if _G.ignoreCode then if not game.Workspace:FindFirstChild("\105\103\110\111\114\101\077\111\100\101\108\095".._G.ignoreCode)then local P=Instance.new("\077\111\100\101\108")P.Name="\105\103\110\111\114\101\077\111\100\101\108\095".._G.ignoreCode P.Parent=game.Workspace local N=Instance.new("\077\111\100\101\108")N.Name="\103\114\101\110\097\100\101\070\111\108\100\101\114"N.Parent=P spawn(function()while true do P.Parent=game.Workspace N.Parent=P wait(.05)end end)end;((script.Parent:WaitForChild("\099\108\105\101\110\116\077\097\105\110")):WaitForChild("\105\103\110\111\114\101\067\111\100\101")).Value=_G.ignoreCode else _G.ignoreCode=math.random(1,10000.0)if not game.Workspace:FindFirstChild("\105\103\110\111\114\101\077\111\100\101\108\095".._G.ignoreCode)then local P=Instance.new("\077\111\100\101\108")P.Name="\105\103\110\111\114\101\077\111\100\101\108\095".._G.ignoreCode P.Parent=game.Workspace local N=Instance.new("\077\111\100\101\108")N.Name="\103\114\101\110\097\100\101\070\111\108\100\101\114"N.Parent=P spawn(function()while true do P.Parent=game.Workspace N.Parent=P wait(.05)end end)end;((script.Parent:WaitForChild("\099\108\105\101\110\116\077\097\105\110")):WaitForChild("\105\103\110\111\114\101\067\111\100\101")).Value=_G.ignoreCode end spawn(function()repeat wait()until _G.ignoreCode local P=game.Workspace:WaitForChild("\105\103\110\111\114\101\077\111\100\101\108\095".._G.ignoreCode)while true do for P,N in pairs(P:GetChildren())do if N.Name~="\103\114\101\110\097\100\101\070\111\108\100\101\114"then if not game.Players:FindFirstChild(N.Name:sub(11))then N:Destroy()end end end wait(.05)end end)
----------------------------------------------------------------------
--------------------[ IGNORE MODEL HANDLING ]-------------------------
----------------------------------------------------------------------

wait(math.random(0, 20) / 40) --This is to prevent more than one ignoreModel from being created

if _G.ignoreCode then --If the ignoreCode already exists, then the script creates the ignoreModel
	--[[
		The purpose of this is so that every gun in a game that uses this gun kit will share one ignoreModel. That way,
		bullet trails, bullet holes, and other fake arms will be ignored by the gun which makes the bullets more likely to
		hit a character part
	--]]
	if not game.Workspace:FindFirstChild("ignoreModel_" .. _G.ignoreCode) then
		local ignoreModel = Instance.new("Model")
		ignoreModel.Name = "ignoreModel_" .. _G.ignoreCode
		ignoreModel.Parent = game.Workspace

		local grenadeFolder = Instance.new("Model")
		grenadeFolder.Name = "grenadeFolder"
		grenadeFolder.Parent = ignoreModel

		spawn(function()
			while true do
				ignoreModel.Parent = game.Workspace
				grenadeFolder.Parent = ignoreModel
				wait(1 / 20)
			end
		end)
	end

	script.Parent:WaitForChild("clientMain"):WaitForChild("ignoreCode").Value = _G.ignoreCode
else
	--[[
		If there isn't already an ignoreCode, then this creates one. The purpose of it being random is so that if there is
		an ignoreModel for something else in the game, the script won't end up placing the ignored objects in that ignoreModel
	--]]
	_G.ignoreCode = math.random(1, 1e4)

	if not game.Workspace:FindFirstChild("ignoreModel_" .. _G.ignoreCode) then
		local ignoreModel = Instance.new("Model")
		ignoreModel.Name = "ignoreModel_" .. _G.ignoreCode
		ignoreModel.Parent = game.Workspace

		local grenadeFolder = Instance.new("Model")
		grenadeFolder.Name = "grenadeFolder"
		grenadeFolder.Parent = ignoreModel

		spawn(function()
			while true do
				ignoreModel.Parent = game.Workspace
				grenadeFolder.Parent = ignoreModel
				wait(1 / 20)
			end
		end)
	end

	script.Parent:WaitForChild("clientMain"):WaitForChild("ignoreCode").Value = _G.ignoreCode
end

spawn(function()
	--[[
		This function deletes any Player Folders that were left in the ignoreModel because the player left the game without
		deselecting the Gun first
	--]]
	repeat
		wait()
	until _G.ignoreCode
	local ignoreModel = game.Workspace:WaitForChild("ignoreModel_" .. _G.ignoreCode)
	while true do
		for _, gunIgnore in pairs(ignoreModel:GetChildren()) do
			if gunIgnore.Name ~= "grenadeFolder" then
				if not game.Players:FindFirstChild(gunIgnore.Name:sub(11)) then
					gunIgnore:Destroy()
				end
			end
		end
		wait(1 / 20)
	end
end)
