How could I make a script that would remove every script from the children of a model?

So, in my game, I used to have the scripts VERY messy and there are over a thousand copies of scripts in a bunch of parts inside a model. If you could help, it would be good.

  1. What do you want to achieve? I have over a thousand parts, each of which have a script (not a virus) and I would like to remove every last one of them.

  2. What is the issue? I just don’t know how to write this.

  3. What solutions have you tried so far? I havent really tried anything because I do not know where to start and what to do.

If you can help, it will help me a lot.

See:

This’ll clear for one instance. You can use a loop across all the instances you want to target and then call a relevant function to clear instances of that type.

for _, desc in ipairs(model:GetDescendants()) do
if (desc:IsA(“Script”)) then
desc:Destroy()
end
end