script.Parent.ChildAdded:connect(function(h) local nt = h for i,v in pairs(game.Lighting:GetChildren()) do if nt.Name ~= v.Name then nt:Destroy() elseif nt.Name == v.Name then print("Right Tool!") end end end)
i want this script to delete the new tool if it's name is not found in lighting. this script only deletes the new tool if there is 1 name in lighting if there are more then 1 names in lighting the new tool wont get destroyed even if its name is not found in lighting. please help me.
Try this:
local sp = script.Parent local lighting = game.Lighting sp.ChildAdded:connect(function(child) local nt = child if lighting:FindFirstChild(nt.Name) then print("Right Tool!") else nt:Destroy() end end)