I want to destroy all parts after a remote event, but not all got destroyed.
for i,v in pairs (workspace:GetChildren()) do
if v.Name == "Clones" then
print("Total")
end
end
remote.OnServerEvent:Wait()
for i,v in pairs (workspace:GetChildren()) do
if v.Name == "Clones" then
v:Destroy()
end
end
for i,v in pairs (workspace:GetChildren()) do
if v.Name == "Clones" then
print("Not destroyed")
end
end
print("Fired")
wait(20)
game.ReplicatedStorage.Timestart:FireAllClients()
print("Firedclients")
Total printed 780x, while Not destroyed printed 660x.
TL;DR : I have 780 parts that want to be destroyed, but only 120 got destroyed.
for i,v in pairs (workspace:GetDescendants()) do
if v.Name == "Clones" then
v:Destroy()
end
end
for i,v in pairs (workspace:GetDescendants()) do
if v.Name == "Clones" then
print("Not destroyed")
end
end
Under it, from this code
‘’’
for i,v in pairs (workspace:GetChildren()) do
if v.Name == “Clones” then
print(“Not destroyed”)
end
end
‘’’
prints Not destroyed (x660)