I am attempting to create a system that destroys parts if they do not have a certain name. Here is my system:
for i,v in pairs(parts) do
local function hit(part)
if time ~= 0 then
if part.Name ~= "Plate" or part.Name ~= "terrain" then
print(part.Name)
part:Destroy()
return
end
end
end
v.Touched:Connect(hit)
end
However, when the script runs, here is the result:
And if you look back at my code, I only ask for part names to be printed if they are to be destroyed. You have also probably guessed those parts were destroyed.
Wow, it works! I thought youād have to put āorā and not āandā since a part canāt have both names at once as āandā would imply. Thank you though!
Usually that is correct, but when reading conditions it is read in a slightly different way: āIf the parts name isnāt āPlateā, and it also isnāt āterrainā then:ā