Reading the code I see that there are a few syntax issues. First, since the method GetChildren()
loops through the children of a parent and returns it in an array, a for loop would be a better way to destroy the parts, as just setting the quantity of parts equal to the Destroy()
function does not work.
1 | local model = game.Workspace.Model |
2 | local modelChildren = model:GetChildren() |
5 | modelChildren [ i ] :Destroy() |
Note: This only deletes the first 5 parts in your model, because it only loops through the first 5, to do the second 5 (2-6), you would do i = 2, 6
If you have any other questions just ask and I'll try to respond!