I'm using a ChildAdded function to try and check if an item that is already there is added so there is two of the same thing, e.g two of the same hammers or bricks or any object that is duplicated. How can I see, when a child is added to this object, if the child already exists so I can destroy it so there is not two of the same thing inside?
Let's say the tool you're using is in ReplicatedStorage that can be cloned to a Player's Backpack. In that case:
local RS = game:GetService("ReplicatedStorage") local Tool = RS:FindFirstChild("Hammer", false) -- Or RS:FindFirstChild("Part") script.Parent.MouseClick:Connect(function() -- I'm assuming you're using a ClickDetector or something local plr = game.Players:GetPlayerFromCharacter(script.Parent) if plr then if not plr.Backpack:FindFirstChild("Hammer") then Tool:Clone().Parent = plr.Backpack end if plr.Backpack:FindFirstChild("Hammer") then local PlrTool = plr.Backpack:FindFirstChild("Hammer") PlrTool:Destroy() end end end)