Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Revelation216's SaveInstance Protosmasher Script
- -- Big black clock#3068
- local SETTINGS = {
- SAVE_AS = "FILENAME"; -- File Name to Save As (Find in your Protosmasher Folder [workspace>saved])
- DECOMPILE_SCRIPTS = true; -- Use if you want to Decompile Scripts (TAKES A LONG TIME FOR A LOT OF SCRIPTS!!!!, Will Decompile ALL SCRIPTS for Enabled WHERE_TO_SAVE)
- OUTPUT_MODE = "OUT"; -- "LOGS" Logs for Dev Console (F9) or "OUT" Output in Protosmasher (Out is more secure)
- SAFE_MODE = false; -- Use if an Anti-Exploit detects this SaveInstance Script (Doesn't Toggle Bool for Archivable Instances from false to true)
- TERRAIN_SAVE = false; -- Uses Protosmasher's saveinstance to Save Terrain to a seperate File named "Terrain_FILENAME"
- WHERE_TO_SAVE = {
- Workspace = true;
- Lighting = true;
- ReplicatedFirst = true;
- ReplicatedStorage = true;
- JointsService = true;
- Players = true;
- StarterGui = true;
- Nil = false; -- Only Saves LocalScripts, ModuleScripts, and Folders (with Children) in Nil
- };
- Version = "1.7.5";
- Change_Log = "1.5.0\n- Public release\n1.7.5\n- Fixed bugs with Nil\n- Fixed Saving process";
- }
- local SaveModel = Instance.new("Model")
- SaveModel.Name = "DataModel"
- local Output = function(String)
- if SETTINGS.OUTPUT_MODE == "OUT" then
- printoutput("\n[RSI]: \n"..tostring(String))
- elseif SETTINGS.OUTPUT_MODE == "LOGS" then
- print("\n[RSI]: \n"..String)
- end
- end
- local DecompileScript = function(Script)
- local DisabledState
- local SV = Instance.new("StringValue")
- SV.Name = Script.Name.."_"..Script.ClassName
- if Script.ClassName == "LocalScript" then
- DisabledState = Script.Disabled
- Script.Disabled = true
- end
- if SETTINGS.DECOMPILE_SCRIPTS == true then
- if decompile then
- local Source
- if Script.ClassName == "LocalScript" or Script.ClassName == "ModuleScript" then
- local Run, Err = pcall(function() Source = decompile(Script) end)
- if Err then Output("Decompiler Ran into Error (skipped source) :\n"..tostring(Err)) Source = "DECOMPILER ERROR" end
- end
- if tostring(Source) == "false" then
- SV.Value = "DECOMPILER IS PATCHED OR HAS ERRORED"
- else
- SV.Value = Source
- end
- elseif not decompile then
- SV.Value = "DECOMPILER NOT FOUND"
- end
- else
- SV.Value = "DECOMPILER DISABLED FROM SCRIPT"
- end
- if Script.ClassName == "LocalScript" then
- Script.Disabled = DisabledState
- end
- return SV
- end
- local CreateBool = function(instance)
- if SETTINGS.SAFE_MODE == true then
- local Bool = Instance.new("BoolValue")
- Bool.Name = tostring(instance).."_ANTIEXPLOIT_SETTING_ENABLED_ARCHIVABLE_FALSE"
- return Bool
- else
- local Bool = Instance.new("BoolValue")
- Bool.Name = tostring(instance)
- return Bool
- end
- end
- local Clone = function(Tree)
- local CTree
- if Tree.ClassName == "Player" then
- local Replace = Instance.new("Folder")
- Replace.Name = Tree.Name
- CTree = Replace
- for Index, Child in pairs(Tree:GetChildren()) do
- local NewFolder = Instance.new("Folder")
- NewFolder.Name = Child.Name
- for Ind, Chil in pairs(Child:GetChildren()) do
- Chil = Chil:Clone()
- Chil.Parent = NewFolder
- end
- NewFolder.Parent = CTree
- end
- elseif Tree.ClassName == "Folder" then
- local Replace = Instance.new("Folder")
- Replace.Name = Tree.Name
- CTree = Replace
- for Ind, Child in pairs(Tree:GetChildren()) do
- Child = Child:Clone()
- Child.Parent = Replace
- end
- else
- CTree = Tree:Clone()
- end
- if CTree ~= nil then
- for Index, Des in pairs(CTree:GetDescendants()) do
- if Des.ClassName == "LocalScript" or Des.ClassName == "ModuleScript" then
- local Dec = DecompileScript(Des)
- local ParentofDes = Des.Parent
- for I, Child in pairs(Des:GetChildren()) do
- Child.Parent = Dec
- end
- Des.Parent = game.RobloxReplicatedStorage --// Yes I know, but it would show in nil when destroyed sooo eh
- Dec.Parent = ParentofDes
- end
- end
- if CTree.ClassName == "LocalScript" or CTree.ClassName == "ModuleScript" then
- local DecompiledScript = DecompileScript(CTree)
- for I, Child in pairs(CTree:GetChildren()) do
- Child.Parent = DecompiledScript
- end
- CTree.Parent = game.RobloxReplicatedStorage
- CTree = DecompiledScript
- end
- else
- return CreateBool("Nil")
- end
- return CTree
- end
- local SaveInstance = function(instance, DoSave)
- local IndexFolder
- if DoSave == true then
- IndexFolder = Instance.new("Folder")
- IndexFolder.Name = instance.Name
- IndexFolder.Parent = SaveModel
- else
- IndexFolder = Instance.new("Folder")
- IndexFolder.Name = instance.Name.."_NOT_ENABLED"
- IndexFolder.Parent = SaveModel
- end
- local Save = function(InsToSave)
- if InsToSave ~= game.Workspace.Terrain and InsToSave ~= game.Workspace.Camera and InsToSave ~= nil then
- if InsToSave.ClassName == "LocalScript" or InsToSave.ClassName == "ModuleScript" then
- local Dec = DecompileScript(InsToSave)
- Dec.Parent = IndexFolder
- else
- local ToParent
- if InsToSave.Archivable == false and SETTINGS.SAFE_MODE == false then
- InsToSave.Archivable = true
- for i, Desn in pairs(InsToSave:GetDescendants()) do
- if Desn.Archivable == false then
- Desn.Archivable = true
- end
- end
- ToParent = Clone(InsToSave)
- elseif InsToSave.Archivable == true and SETTINGS.SAFE_MODE == false then
- ToParent = Clone(InsToSave)
- elseif SETTINGS.SAFE_MODE == true and InsToSave.Archivable == true then
- ToParent = Clone(InsToSave)
- elseif SETTINGS.SAFE_MODE == true and InsToSave.Archivable == false then
- local Ins = CreateBool(InsToSave)
- ToParent = IndexFolder
- end
- ToParent.Parent = IndexFolder
- end
- else
- if InsToSave == game.Workspace.Terrain and SETTINGS.TERRAIN_SAVE == true then
- Output("Saving Terrain as: Terrain_"..SETTINGS.SAVE_AS)
- if saveinstance then
- saveinstance(InsToSave, "Terrain_"..SETTINGS.SAVE_AS, false)
- else
- error("saveinstance NOT FOUND!")
- end
- else
- local Ins = CreateBool(InsToSave)
- Ins.Parent = IndexFolder
- end
- end
- end
- local Children = instance:GetChildren()
- if #Children >= 1 and DoSave == true then
- for Index, Child in pairs(Children) do
- Save(Child)
- end
- elseif #Children == 0 and DoSave == true then
- instance = instance.Name.."_NO_CHILDREN"
- IndexFolder = CreateBool(instance)
- end
- Output("Instance: "..tostring(instance.Name).."\nSaved: "..tostring(DoSave).."\nChildren: "..tostring(#Children))
- end
- local Start = function()
- Output("Begining Compilation of DataModel...")
- SaveInstance(game:GetService("Workspace"), SETTINGS.WHERE_TO_SAVE.Workspace)
- SaveInstance(game:GetService("Lighting"), SETTINGS.WHERE_TO_SAVE.Lighting)
- SaveInstance(game:GetService("ReplicatedFirst"), SETTINGS.WHERE_TO_SAVE.ReplicatedFirst)
- SaveInstance(game:GetService("ReplicatedStorage"), SETTINGS.WHERE_TO_SAVE.ReplicatedStorage)
- SaveInstance(game:GetService("JointsService"), SETTINGS.WHERE_TO_SAVE.JointsService)
- SaveInstance(game:GetService("Players"), SETTINGS.WHERE_TO_SAVE.Players)
- SaveInstance(game:GetService("StarterGui"), SETTINGS.WHERE_TO_SAVE.StarterGui)
- if SETTINGS.WHERE_TO_SAVE.Nil == true then
- if get_nil_instances then
- local Nil = Instance.new("Folder")
- Nil.Name = "Nil"
- Nil.Parent = SaveModel
- for Index, Nilled in pairs(get_nil_instances()) do
- if Nilled.ClassName == "LocalScript" or Nilled.ClassName == "ModuleScript" then
- local Script = DecompileScript(Nilled)
- Script.Parent = Nil
- elseif Nilled.ClassName == "Folder" then
- print("Fold: "..tostring(Nilled))
- local Cl = Clone(Nilled)
- Cl.Parent = Nil
- end
- end
- else
- Output("get_nil_instances NOT FOUND")
- local Nil = Instance.new("Folder")
- Nil.Name = "Nil_NOT_FOUND"
- Nil.Parent = SaveModel
- end
- else
- local Nil = Instance.new("Folder")
- Nil.Name = "Nil_NOT_ENABLED"
- Nil.Parent = SaveModel
- end
- Output("Instance: Nil\nSaved: "..tostring(SETTINGS.WHERE_TO_SAVE.Nil))
- Output("Compiled DataModel!\nSaving DataModel as: "..SETTINGS.SAVE_AS)
- if saveinstance then
- saveinstance(SaveModel, SETTINGS.SAVE_AS, false)
- else
- Output("saveinstance NOT FOUND!")
- end
- end
- Output("Big Black Clocks Protosmasher SaveInstance Script\nVersion: "..SETTINGS.Version.."\n"..SETTINGS.Change_Log)
- local run, err = pcall(Start)
- if err then
- Output("An Error occured!\nRevelation216#6140 for bugs\n"..err)
- else
- Output("Successfully Saved DataModel")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement