I have a script which, when a part is added to the workspace it'll be destroyed. But, whenever a part is added into the workspace I get this error, in orange; Something unexpectedly tried to set the parent of Part to NULL while trying to set the parent of Part. Current parent is Workspace.
Here is my code;
game.Workspace.DescendantAdded:connect(function()
for _, v in pairs(game.Workspace:GetChildren()) do
if v.Name == "Part" and v:IsA("Part") then
v:Destroy()
end
end
end)
Any help is appreciated! Thanks! `

1 comment
It is better to use v:IsA("BasePart"), since that'll include all Parts.