Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I remove all scripts from my game?

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

✓ Accepted answer
-- 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'))`

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.

1 comment

0

That would also delete the bricks. I don't want to delete my hard work, just the scripts within them.

This discussion is preserved as it was. New answers, comments, and votes are closed.