Hey, I've been trying to remove a child from a parent, but for some reason this doesn't execute, yet no errors lie in the output.
while wait() do index = 0 for index, child in pairs(workspace:FindFirstChild("20PercentBrickMesh"):GetChildren()) do if child.Name == "Mesh" then child:Destroy() print("Removed:" .. index .. child) index = index + 1 end end end
My objective here was to grab all the 20PercentBrickMeshes, and delete the Meshes inside of them, as they lag up the server. The setup in the Hierarchy of the parts are:
game-> Workspace -> 20PercentBrickMesh -> Mesh
I'm not sure what's wrong.