Last active
December 28, 2022 20:29
-
-
Save michlbro/0eb3ebb5ad823eef1da01b5e55dca310 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
Created by XxprofessgamerxX | |
25/12/2022. | |
- Pulls out every single script in game and puts them in a folder. | |
- Basically using this to find out what scripts exist and just to have an empty map that I can sort out. | |
- Also deletes the scripts along with its constituents | |
]] | |
local pathScriptDump = workspace -- Path | |
local scriptDumpName = "ScriptsPulled" -- Name | |
local placesToSerch = { | |
workspace, | |
game:GetService("Lighting"), | |
game:GetService("ReplicatedFirst"), | |
game:GetService("ReplicatedStorage"), | |
game:GetService("ServerScriptService"), | |
game:GetService("ServerStorage"), | |
game:GetService("StarterGui"), | |
game:GetService("StarterPlayer"), | |
game:GetService("Teams"), | |
game:GetService("SoundService") | |
} | |
local function CreateFolder(scriptsPulled, path, instance) | |
local currentSavedFolderParent = scriptsPulled | |
for index, child in path do | |
local folderFound = currentSavedFolderParent:FindFirstChild(child.Name) | |
if not folderFound then | |
folderFound = Instance.new("Folder") | |
folderFound.Name = child.Name | |
folderFound.Parent = currentSavedFolderParent | |
local instanceType = Instance.new("StringValue") | |
instanceType.Name = "ClassName" | |
instanceType.Value = child.ClassName | |
instanceType.Parent = folderFound | |
end | |
if index == #path then | |
local clonedInstance = instance:Clone() | |
clonedInstance.Parent = folderFound | |
end | |
currentSavedFolderParent = folderFound | |
end | |
end | |
local function SearchForScripts(scriptsPulled, toSearch, path) | |
local initialPath = path and {table.unpack(path)} or {} | |
for _, instance in toSearch do | |
if instance.Name == scriptDumpName and instance:IsA("Folder") then | |
continue | |
end | |
local currentPath = {table.unpack(initialPath)} | |
table.insert(currentPath, instance) | |
if instance:IsA("Script") or instance:IsA("LocalScript") or instance:IsA("ModuleScript") then | |
print(string.format("Found: %s. Putting it in script dump.", instance)) | |
CreateFolder(scriptsPulled, initialPath, instance) | |
-- instance:Destroy() -- if you want to destroy them after dumping them. | |
continue | |
end | |
SearchForScripts(scriptsPulled, instance:GetChildren(), currentPath) | |
end | |
end | |
local function Setup() | |
local scriptsPulled: Folder? = nil | |
if pathScriptDump:FindFirstChild(scriptDumpName) then | |
scriptsPulled = pathScriptDump:FindFirstChild(scriptDumpName) | |
else | |
scriptsPulled = Instance.new("Folder") | |
scriptsPulled.Name = scriptDumpName | |
scriptsPulled.Parent = pathScriptDump | |
end | |
SearchForScripts(scriptsPulled, placesToSerch) | |
print("DONE!") | |
end | |
Setup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment