Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

A script that finds every script in game and deletes it?

Asked by
lomo0987 250 Moderation Voter
10 years ago

I am wondering if there are scripts out there that does this, if not.. How would I make one? What will I need to know?

Edit: What it would do is search through everything in the workspace and delete all of the scripts.

2 answers

Log in to vote
1
Answered by 10 years ago
function RemoveAll(p)
    for _,v in pairs(p:GetChildren()) do
        if v:IsA("Script") then
            v:Destroy()
        else
            RemoveAll(v)
        end
    end
end

RemoveAll(game.Workspace)
0
Works perfectly. lomo0987 250 — 10y
Ad
Log in to vote
0
Answered by 10 years ago
for _,script in ipairs(game.Workspace:GetChildren()) do -- Get everything in the workspace one at a time, and that thing is called "script"
if script:IsA("Script") then -- Check if the class of that object in workspace is script
script:Destroy()--Completely remove the script from workspace.
elseif script:IsA("Model") then -- Checks if it's a model
for _,modchild in ipairs(script:GetChildren()) do -- Get every child of the model
if modchild:IsA("Script") then
modchild:Destroy()
end
end
end
end
0
It only gets scripts if they are directly within Workspace. Is there any way to edit it so it checks within models of the Workspace too? lomo0987 250 — 10y
0
Updated. If there's models or groups inside of the model, I think you can figure it out. xDeathBear 90 — 10y

Answer this question