--local busy = false
--Shield.Touched:connect(function(Hit)
--	if Hit == nil then return end
--	if Hit.Parent == nil then return end
--	if busy == true then return end
--	
--	busy = true	
--	
--	local Item = Hit.Parent
--	
--	if Item:IsA("Tool") == true then return end
--	if Hit.Name == "Torso" then return end
--	if Hit.Name == "HumanoidRootPart" then return end
--	if Hit.Name == "Left Leg" then return end
--	if Hit.Name == "Right Leg" then return end
--	if Hit.Name == "Head" then return end
--	if Hit.Name == "Left Arm" then return end
--	if Hit.Name == "Right Arm" then return end
--	
--	if Game:GetService("Players"):GetPlayerFromCharacter(Item) ~= nil then return end
--	
--	local touch = false
--	for _, x in ipairs(Hit:GetChildren()) do
--		if x:IsA("TouchTransmitter") == true then touch = true x:Destroy() break end
--	end
--	
--	local owner, dmg = GetOwnerAndDamage(Hit)
--	if owner ~= nil and dmg ~= nil then
--		if Health > 0 then
--			if Health >= dmg then
--				Health = Health - dmg
--				
--				if Health < 0 then Health = 0 end
--				
--				HealthBar.Shield.Bar:TweenSize(UDim2.new((Health / MaxHealth), 0, 1, 0), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 0.5, true)
--				
--				if Health > 0 then
--					-- yay, still alive.
--				else
--					HealthBar.Parent.Parent:Destroy()
--				end
--				
--				Hit:Destroy()
--			else
--				HealthBar.Parent.Parent:Destroy()
--			end
--		else
--			HealthBar.Parent.Parent:Destroy()
--		end
--	else
--		if touch == true then
--			--Hit:Destroy()
--		end
--	end
--	
--	busy = false
--end)



function Check(p)
	for _, x in ipairs(p:GetChildren()) do
		if x:IsA("IntValue") == true then
			if x.Value == id then
				return false
			end
		end
	end
	
	return true
end

Shield.Touched:connect(function(Hit)
	if Hit == nil then return end
	if Hit.Parent == nil then return end
	
	local Item = Hit.Parent
	
	if Item:IsA("Tool") == true then return end
	if Hit.Name == "Torso" then return end
	if Hit.Name == "HumanoidRootPart" then return end
	if Hit.Name == "Left Leg" then return end
	if Hit.Name == "Right Leg" then return end
	if Hit.Name == "Head" then return end
	if Hit.Name == "Left Arm" then return end
	if Hit.Name == "Right Arm" then return end
	if Hit:FindFirstChild("Pierce") ~= nil then return end
	if Check(Hit) == false then return end
	
	if Game:GetService("Players"):GetPlayerFromCharacter(Item) ~= nil then return end
	
	for _, x in ipairs(Hit:GetChildren()) do
		if x:IsA("TouchTransmitter") == true then x:Destroy() break end
	end
	
	Shield:Destroy()
end)

function CreateRegion3FromLocAndSize(Position, Size)
	local SizeOffset = Size / 2
	local Point1 = Position - SizeOffset
	local Point2 = Position + SizeOffset
	return Region3.new(Point1, Point2)
end

function FindNear(part, radius)
	local r = CreateRegion3FromLocAndSize(part.Position, Vector3.new(part.Size.X + radius, 50, part.Size.Z + radius))
	
	return Game:GetService("Workspace"):FindPartsInRegion3(r, part, 100)
end

while Shield and Shield.Parent do
	for _, item in ipairs(FindNear(Shield, 15)) do
		if item:IsA("BasePart") == true then
			local own, dmg = GetOwnerAndDamage(item)
		
			if own ~= nil and dmg ~= nil and item:FindFirstChild("Pierce") == nil and Check(item) == true then
				if (item.Position - Shield.Position).magnitude <= 15 and item ~= Shield then
					item:Destroy()
					
					Shield:Destroy()
				end
			end
		end
	end
	
	Game:GetService("RunService").Stepped:wait()
end