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

How do I remove all scripts from my game?

Asked by
Scerzy 85
8 years ago

So I was on studio, and I noticed someone added scripts to EVERY brick in the game. Not only that, but there's a Class Fire with a spread script inside of it. I cannot manually delete them all as there are more than 5,000 bricks. Is there a function that lets me locate all instances of a script and fire in the workspace and remove them?

I just need to be pointed in the right direction, such as the name of the command to have the script recognize all scripts in the workspace.

2 answers

Log in to vote
2
Answered by
ImageLabel 1541 Moderation Voter
8 years ago
-- You can use recursion to scan through certain services/models, in 
-- search for instances matching a certain standard.
-- If no matches found, it automatically calls the function "scan" on children,
-- therefore repeating the process until possible matches are found.

scan = function (repository)
    local repo = repository:GetChildren()

    for serial, value in pairs(repo) do
        if value:isA('BaseScript') then -- both local and server scripts
            warn(value:GetFullName())
            value:Destroy()

        else
            scan(value)     
        end
    end
    wait(.5)
end

scan(game) 
-- scan through DataModel, might take some time, or cause a little bit
-- of latency, depending on the size of your game.

-- If the scripts are in a specific services, you could save some time by
-- scanning through said service.

`scan(game:GetService('Workspace'))`
Ad
Log in to vote
-3
Answered by 8 years ago

You could just click the top of the bricks and press shift and hold it then click the last of the brick then delete it, simple fix to your problem.

0
That would also delete the bricks. I don't want to delete my hard work, just the scripts within them. Scerzy 85 — 8y

Answer this question