Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local MaxThreads = 20;
- local MarketplaceService = game:GetService("MarketplaceService");
- local PlaceId = game.PlaceId;
- local PlaceName;
- local Success, GameInfo = pcall(function()
- return MarketplaceService:GetProductInfo(PlaceId);
- end)
- if Success then
- PlaceName = GameInfo.Name;
- else
- error(PlaceId,"not recognised.");
- end
- local FolderName = PlaceName.." Script Dump";
- makefolder(FolderName);
- local ParentsToCheck = {
- workspace,
- game.Players.LocalPlayer.PlayerGui,
- game.ReplicatedStorage
- }
- local Scripts = {};
- for _, Parent in next, ParentsToCheck do
- for _, Descendant in next, Parent:GetDescendants() do
- if Descendant:IsA("LocalScript") or Descendant:IsA("ModuleScript") then
- table.insert(Scripts, Descendant);
- end
- end
- end
- local ScriptsToDecompile = (#Scripts);
- local Decompiled = 0;
- local Progress = Decompiled / ScriptsToDecompile;
- function GetUserResolution()
- local UserTest = Instance.new("ScreenGui", game:GetService("CoreGui"));
- local Size = UserTest.AbsoluteSize;
- UserTest:Destroy();
- return Size.X, Size.Y;
- end
- local SizeX, SizeY = GetUserResolution();
- local Tracker = Drawing.new("Square");
- Tracker.Size = Vector2.new(702,32);
- Tracker.Position = Vector2.new((SizeX/2)-(702/2),(SizeY-(32+5)));
- Tracker.Color = Color3.fromRGB(0,0,0);
- Tracker.Filled = true;
- Tracker.Visible = true;
- local Fill = Drawing.new("Square");
- Fill.Size = Vector2.new(Progress*700,30);
- Fill.Position = Vector2.new((SizeX/2)-(700/2),(SizeY-(31+5)));
- Fill.Color = Color3.fromRGB(255,255,255);
- Fill.Filled = true;
- Fill.Visible = true;
- local Decompiling = Drawing.new("Text");
- Decompiling.Size = 20;
- Decompiling.Color = Color3.fromRGB(255,255,255);
- Decompiling.Text = "Decompiling "..ScriptsToDecompile.." scripts.";
- Decompiling.Visible = true;
- function UpdateText()
- local DSizeX, DSizeY = Decompiling.TextBounds.X, Decompiling.TextBounds.Y;
- Decompiling.Position = Vector2.new((SizeX/2)-(DSizeX/2),(SizeY-5));
- end
- UpdateText();
- local Hierarchy = {
- [FolderName] = {
- }
- }
- function UpdateFill()
- local FillX = (Progress * 700);
- Fill.Size = Vector2.new(FillX,30);
- Fill.Position = Vector2.new((SizeX/2)-(FillX/2),(SizeY-(31+5)));
- end
- function MakeHierarchy(FromDirectory)
- local StartDirectory = FolderName;
- local ToCheck = FromDirectory:split("/");
- table.remove(ToCheck);
- local Start = Hierarchy[StartDirectory];
- local Checked = {};
- for Idx, Parent in next, ToCheck do
- table.insert(Checked, Parent);
- if not Start[Parent] then
- Start[Parent] = {};
- makefolder(FolderName.."/"..table.concat(Checked, "/"))
- end
- Start = Start[Parent];
- end
- end
- wait(1);
- local StartTick = tick();
- local CurrentThreads = 0;
- local Threads = {};
- function TryNewThread(Script)
- if (CurrentThreads >= MaxThreads) then
- spawn(function()
- repeat
- wait()
- until (CurrentThreads < MaxThreads)
- TryNewThread(Script);
- end)
- else
- table.insert(Threads, Script)
- CurrentThreads = CurrentThreads + 1;
- spawn(function()
- MakeHierarchy(Script:GetFullName():gsub("%.", "/"));
- pcall(function()
- Decompiling.Text = "Decompiling: game."..Script:GetFullName();
- end)
- pcall(UpdateText);
- writefile(FolderName.."/"..Script:GetFullName():gsub("%.", "/")..".lua", decompile(Script));
- Decompiled = Decompiled + 1;
- Progress = Decompiled / ScriptsToDecompile;
- pcall(UpdateFill);
- CurrentThreads = CurrentThreads - 1;
- end)
- end
- end
- for _, Script in next, Scripts do
- TryNewThread(Script);
- end
- repeat
- wait()
- until (#Threads == ScriptsToDecompile)
- local TimeTaken = tick() - StartTick;
- writefile(FolderName.."/".."log.txt", "Time Taken: "..TimeTaken.."ms.\nScripts Decompiled: "..ScriptsToDecompile..".");
- Tracker:Remove();
- Fill:Remove();
- Decompiling:Remove();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement