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

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

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

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

1 comment

0

Works perfectly.

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

2 comments

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?

0

Updated. If there's models or groups inside of the model, I think you can figure it out.

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