So I made a character customization script and I dont know why when an accessory enters the character it glitches out. I added to the script that it would check if the player already has this accessory in him/her, but it didn't seem to do anything. Here is what i'm talking about

https://gyazo.com/60baed3fbbe944edbd47d0cf53fd71c9

and here is the script thats inside the buttons. Seems to work fine in studio.

game.ReplicatedStorage.EventStorage.Outfit5.OnServerEvent:Connect(function(plr)
	local char = plr.Character or plr.CharacterAdded:Wait()
	local MWeb = game.ReplicatedStorage.EventStorage.MWeb
	local Storage = game.ReplicatedStorage.TeamU.Web1
	local char = plr.Character
	if not char then return end
	if char:FindFirstChild("Humanoid") then
		
		for _, child in pairs(char:GetChildren()) do
    if child:IsA("Accessory") and child.Handle.AccessoryWeld.Part1 == char.UpperTorso then
        child:Destroy()
    end
end
			local neweb = Storage:Clone()
			neweb.Parent = char
		
			char:FindFirstChild("Shirt").ShirtTemplate = "http://www.roblox.com/asset/?id=4531115997" 
			char:FindFirstChild("Pants").PantsTemplate = "http://www.roblox.com/asset/?id=4531240452" 
			
		end
	end)