Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does my loop try to delete "Terrain" when it doesn't match the strings?

Asked by
CjayPlyz 643 Moderation Voter
4 years ago

Script:

for i, part in pairs (workspace:GetChildren()) do
    if part.Name == "Part1" or "Part2" then
        print(part.Name)
        part:Destroy()
    end
end

Output:

Camera
Terrain
14:36:58.485 - Cannot Destroy() Terrain
0
show us more of ur script cuz thats clearly not the part that prints that HappyTimIsHim 652 — 4y
0
also i think you need to do part.Name == "Part1" or part.Name == "Part2" HappyTimIsHim 652 — 4y

Answer this question