I am trying to run a command in the command bar to remove all scripts from a model, and it works, only for one model. WHY?

I just don’t know why it is only working for one model! I have even checked if i was spelling the model right.

  1. What do you want to achieve? I want to clean up the scripts but this is a hassle.

  2. What is the issue? The command is only working in one model.

  3. What solutions have you tried so far? I don’t think there is any solutions out there.

If you can help, please do!

Also, if I put this in the wrong category, I hope it is okay because I couldn’t find the correct category.

Could you post the command to help us out?

The command is

local model = game.ServerStorage.Maps.Symmetry.Paintableparts.PaintedCube

for _, child in pairs(model:GetDescendants()) do
if (child:IsA(“Script”) or child:IsA(“LocalScript”)) then
child:Destroy()
end
end

Are there any errors in the output when you run it?

No errors, at all. It will be amazing if you can help!

Are you saying there are more models under the PaintedCube and its only doing one of them?

I’m honestly lost ahaha, the only thing I could think it to be would be the path you defined model as - though I’m pretty sure that would throw an error if it was the issue.

I should double check, but I did use the autocorrect

If you dont know, PaintedCube is under a model. I have 3 maps, only one will remove the scripts when the command is ran.

Could you attach an image here of the explorer, so we can see the layout described in more detail?

Screen Shot 2021-08-19 at 7.58.59 PM
These are the maps.

Opposition is the only one that worked.

So am I right in saying that you are changing the map variable each time to make it work for each map?

Yes. Thats what i am doing to do this.

Do you have the output tab open, just to be sure?

Yessir! I sure do. :slight_smile: I hope you can help!

and when you run the command, nothing pops up?? if not, I’m really sorry but I’m just completely lost, the code you sent should work as long as the variable is correctly defined.

Yes, nothing pops up. :sad: :frowning_face: It was helpful for you to try!