Advertisement
Xxploitboi

THEGAMESTEALER9000!

Apr 16th, 2018
2,099
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
LScript 13.75 KB | None | 0 0
  1. local Classes; -- Author @Rerumu <3
  2. local Props         = {};
  3. local Concat        = table.concat; -- Concatenation is going to get reworked just a couple times maybe?
  4. local tostring      = tostring;
  5. local Players       = game:GetService('Players');
  6. local Beat          = game:GetService('RunService').Heartbeat;
  7.  
  8. -- Changelog
  9. --[[
  10.     * Whatever version this is
  11.         - Re-did Elysian callback stuff because it was slow
  12.         - Added an Elysian fallback to LuaDec whenever needed
  13.         -- Delays improved
  14.         -- Changed how LocalPlayer and nil are handled
  15.         --- Fixed Synapse support
  16. ]]
  17.  
  18. local InNil;
  19. local Print;
  20. local WritesFl;
  21. local Decompile;
  22.  
  23. local SaveList  = {
  24.     game:GetService('Workspace');
  25.     game:GetService('ReplicatedFirst');
  26.     game:GetService('ReplicatedStorage');
  27.     game:GetService('ServerStorage'); -- Internal stuff
  28.     game:GetService('Lighting');
  29.     game:GetService('StarterGui');
  30.     game:GetService('StarterPack');
  31.     game:GetService('StarterPlayer');
  32.     game:GetService('Teams');
  33.     game:GetService('InsertService');
  34. };
  35.  
  36. local IgnoredList   = {
  37.     'CameraScript';
  38.     'ControlScript';
  39.     'ChatScript';
  40.     'BubbleChat';
  41.     'Camera';
  42. }
  43.  
  44. local NoNoProp  = {
  45.     Instance    = {
  46.         Archivable      = true,
  47.         DataCost        = true,
  48.         ClassName       = true,
  49.         RobloxLocked    = true,
  50.         Parent          = true
  51.     };
  52.     BasePart    = {
  53.         Position    = true,
  54.         Rotation    = true
  55.     };
  56. };
  57.  
  58. for Idx = 1, 3 do
  59.     local Ran, Err  = ypcall(function()
  60.         Classes = game:HttpGet('http://anaminus.github.io/rbx/json/api/latest.json', true);
  61. --      Classes = game:GetService('HttpService'):GetAsync('http://anaminus.github.io/rbx/json/api/latest.json');
  62.     end);
  63.  
  64.     if (not Ran) then
  65.         if (Idx == 3) then
  66.             error(Err, 0);
  67.         else
  68.             wait(1);
  69.         end;
  70.     else -- Setup stuff
  71.         local Me        = Players.LocalPlayer;
  72.  
  73.         for _, Player in next, Players:GetPlayers() do
  74.             if (Player ~= Me) then
  75.                 table.insert(IgnoredList, tostring(Player)); -- Let's *not*
  76.             end;
  77.         end;
  78.  
  79.         local NumIg = #IgnoredList;
  80.  
  81.         Classes = game:GetService('HttpService'):JSONDecode(Classes);
  82.  
  83.         for Idx = 1, NumIg do
  84.             IgnoredList[IgnoredList[Idx]]   = true;
  85.             IgnoredList[Idx]    = nil;
  86.         end;
  87.  
  88.         break;
  89.     end;
  90. end;
  91.  
  92. if elysianexecute then -- Scripts is handled async in Elysian because the decompiler is callback based
  93.     local Sources   = {};
  94.  
  95.     InNil       = getnilinstances;
  96.     WritesFl    = writefile;
  97.  
  98.     function Decompile(Script) -- Austin finna gonna make me die
  99.         local Name  = Script.Name; -- Remove if you don't want a cache
  100.         local Scr   = Sources[Name];
  101.  
  102.         if (not Scr) then
  103.             local Timeout   = tick() + 8;
  104.  
  105.             local Ran, Err = decompile(Script, 'unluac', newcclosure(function(Res, Err) -- Fix or something on newcclosure
  106.                 if Res then
  107.                     Scr = Res:gsub('\r+', ''); -- Austin-proof newline machine
  108.                 else
  109.                     Scr = '--[[\n' .. tostring(Err) .. '\n--]]';
  110.                 end;
  111.             end));
  112.  
  113.             if (not Ran) then
  114.                 Scr = '--[[\n' .. tostring(Err) .. '\n--]]';
  115.             else
  116.                 Print('Decompiling ' .. Script:GetFullName());
  117.  
  118.                 Beat:wait();
  119.             end;
  120.  
  121.             while (not Scr) do
  122.                 if (tick() > Timeout) then
  123.                     Print('Script timeout ' .. Script:GetFullName());
  124.  
  125.                     Scr = '-- Unluac timed out, falling back to LuaDec\n';
  126.  
  127.                     Beat:wait();
  128.                     Beat:wait();
  129.  
  130.                     Ran, Err    = decompile(Script);
  131.  
  132.                     if Ran then
  133.                         Print('LuaDec fallback succeeded');
  134.  
  135.                         Scr = Scr .. Ran;
  136.                     else
  137.                         Scr = Scr .. '--[[\n' .. tostring(Err) .. '\n--]]';
  138.                     end;
  139.  
  140.                     break;
  141.                 else
  142.                     Beat:wait(); -- Shouldn't cause an issue
  143.                     Beat:wait();
  144.                 end;
  145.             end;
  146.  
  147.             Sources[Name]   = Scr;
  148.         end;
  149.  
  150.         return Scr;
  151.     end;
  152.  
  153.     function Print(String)
  154.         printconsole(String, 100, 200, 180);
  155.     end;
  156.  
  157.     Print('ReruSavePlace detected Elysian, functions loaded');
  158. elseif Synapse then -- Oh my god 3ds why couldn't you just use '.' syntax
  159.     function InNil()
  160.         return Synapse:GetNilInstances();
  161.     end;
  162.  
  163.     function WritesFl(Location, Data)
  164.         return Synapse:WriteFile(Location, Data);
  165.     end;
  166.  
  167.     function Decompile(Script)
  168.         return Synapse:Decompile(Script);
  169.     end;
  170.  
  171.     Print = warn;
  172.  
  173.     Print('ReruSavePlace detected Synapse, functions loaded');
  174. else
  175.     error('This exploit may not be supported by RSP, please contact me');
  176. end;
  177.  
  178. do
  179.     local Temp  = {};
  180.  
  181.     for Idx, Val in next, Classes do
  182.         if (Val.type == 'Class') then
  183.             Temp[Val.Name]  = Val;
  184.             Temp[Val.Name].Properties   = {};
  185.         elseif (Val.type == 'Property') then
  186.             local Ignore;
  187.  
  188.             for _, Tag in next, Val.tags do
  189.                 if (Tag == 'deprecated') or (Tag == 'readonly') then
  190.                     Ignore  = true;
  191.  
  192.                     break;
  193.                 end;
  194.             end;
  195.  
  196.             if (not Ignore) then
  197.                 local Ignored   = NoNoProp[Val.Class];
  198.  
  199.                 if Ignored and Ignored[Val.Name] then
  200.                     Ignore  = true;
  201.                 end;
  202.  
  203.                 if (not Ignore) then
  204.                     local Props = Temp[Val.Class].Properties;
  205.  
  206.                     Props[#Props + 1]   = Val;
  207.                 end;
  208.             end;
  209.         end;
  210.     end;
  211.  
  212.     Classes = Temp;
  213. end;
  214.  
  215. local function PropsOf(Obj)
  216.     if Props[Obj.ClassName] then
  217.         return Props[Obj.ClassName];
  218.     end;
  219.  
  220.     local Prop  = {};
  221.     local Class = Obj.ClassName;
  222.  
  223.     while Class do
  224.         local Curr  = Classes[Class];
  225.  
  226.         for Index, Value in next, Curr.Properties do
  227.             Prop[#Prop + 1] = Value;
  228.         end;
  229.  
  230.         Class = Curr.Superclass;
  231.     end;
  232.  
  233.     table.sort(Prop, function(A, B)
  234.         return A.Name < B.Name;
  235.     end);
  236.  
  237.     Props[Obj.ClassName] = Prop;
  238.  
  239.     return Prop;
  240. end;
  241.  
  242. local function SetParent(Obj, Parent)
  243.     local Cloned;
  244.  
  245.     if Obj.Archivable then
  246.         Cloned = Obj:Clone();
  247.     end;
  248.  
  249.     if (not Cloned) then
  250.         local pcall = pcall;
  251.  
  252.         Cloned = Instance.new'Folder'
  253.  
  254.         for Index, Child in next, Obj:GetChildren() do
  255.             pcall(SetParent, Child, Cloned);
  256.         end;
  257.  
  258.         Cloned.Name     = Obj.Name .. ':' .. Obj.ClassName;
  259.     end;
  260.  
  261.     Cloned.Parent   = Parent;
  262. end;
  263.  
  264. local function SavePlaceAsync()
  265.     local Count = 0;
  266.     local Final = {};
  267.     local Timer = tick();
  268.     local Saved = setmetatable({}, {__index = function(This, Idx) local C = Count + 1; Count = C; This[Idx] = C; return C; end});
  269.  
  270.     local pcall = pcall; -- Skid syndrome
  271.  
  272.     Final[1]    = '<roblox xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.roblox.com/roblox.xsd" version="4"><External>null</External><External>nil</External>';
  273.     Print('Saving place...');
  274.  
  275.     local function SaveInstance(Obj)
  276.         if Classes[Obj.ClassName] and (not IgnoredList[Obj.Name]) then
  277.             local Props = PropsOf(Obj);
  278.             local Num   = Saved[Obj];
  279.             local Conversions   = {
  280.                 ['&']   = '&amp;';
  281.                 ['<']   = '&lt;';
  282.                 ['>']   = '&gt;';
  283.             }
  284.  
  285.             Final[#Final + 1]   = '<Item class="' .. Obj.ClassName .. '" referent="RBX' .. Num .. '"><Properties>';
  286.  
  287.             if ((Num % 1080) == 0) then
  288.                 Beat:wait();
  289.             end;
  290.  
  291.             for _, Prop in next, Props do
  292.                 local Append;
  293.                 local Type = Prop.ValueType;
  294.                 local ObjProp = Prop.Name;
  295.                 local Objp = Obj[ObjProp];
  296.  
  297.                 if (typeof(Objp) == 'EnumItem') then
  298.                     Append  = '<token name="' .. ObjProp .. '">' .. Objp.Value .. '</token>';
  299.                 else
  300.                     if (Type == 'bool') then
  301.                         Append  = '<bool name="' .. ObjProp .. '">' .. tostring(Objp) .. '</bool>';
  302.                     elseif (Type == 'float') then
  303.                         Append = '<float name="' .. ObjProp .. '">' .. tostring(Objp) .. '</float>';
  304.                     elseif (Type == 'int') then
  305.                         Append = '<int name="' .. ObjProp .. '">' .. tostring(Objp) .. '</int>';
  306.                     elseif (Type == 'double') then
  307.                         Append = '<float name="' .. ObjProp .. '">' .. tostring(Objp) .. '</float>';
  308.                     elseif (Type == 'string') then
  309.                         local String = Objp:gsub("[&<>]", Conversions); -- Because I got C O M P L A I N T S
  310.  
  311.                         Append = '<string name="' .. ObjProp .. '">' .. String .. '</string>';
  312.                     elseif (Type == 'BrickColor') then
  313.                         Append = '<int name="' .. ObjProp .. '">' .. Objp.Number .. '</int>';
  314.                     elseif (Type == 'Vector2') then
  315.                         Append =
  316.                             '<Vector2 name="' .. ObjProp .. '">'
  317.                         .. '<X>' .. Objp.x .. '</X>'
  318.                         .. '<Y>' .. Objp.y .. '</Y>'
  319.                         .. '</Vector2>'
  320.                     elseif (Type == 'Vector3') then
  321.                         Append =
  322.                             '<Vector3 name="' .. ObjProp .. '">'
  323.                         .. '<X>' .. Objp.x .. '</X>'
  324.                         .. '<Y>' .. Objp.y .. '</Y>'
  325.                         .. '<Z>' .. Objp.z .. '</Z>'
  326.                         .. '</Vector3>'
  327.                     elseif (Type == 'CoordinateFrame') then
  328.                         local X, Y, Z, R00, R01, R02, R10, R11, R12, R20, R21, R22 = Objp:components()
  329.  
  330.                         Append =
  331.                             '<CoordinateFrame name="' .. ObjProp .. '">'
  332.                         .. '<X>' .. X .. '</X>'
  333.                         .. '<Y>' .. Y .. '</Y>'
  334.                         .. '<Z>' .. Z .. '</Z>'
  335.                         .. '<R00>' .. R00 .. '</R00>'
  336.                         .. '<R01>' .. R01 .. '</R01>'
  337.                         .. '<R02>' .. R02 .. '</R02>'
  338.                         .. '<R10>' .. R10 .. '</R10>'
  339.                         .. '<R11>' .. R11 .. '</R11>'
  340.                         .. '<R12>' .. R12 .. '</R12>'
  341.                         .. '<R20>' .. R20 .. '</R20>'
  342.                         .. '<R21>' .. R21 .. '</R21>'
  343.                         .. '<R22>' .. R22 .. '</R22>'
  344.                         .. '</CoordinateFrame>'
  345.                     elseif (Type == 'Content') then
  346.                         local String = Objp:gsub("[&<>]", Conversions);
  347.  
  348.                         Append = '<Content name="' .. ObjProp .. '"><url>' .. String .. '</url></Content>';
  349.                     elseif (Type == 'UDim2') then
  350.                         local Objp  = Objp;
  351.  
  352.                         Append =
  353.                             '<UDim2 name="' .. ObjProp .. '">'
  354.                         .. '<XS>' .. Objp.X.Scale .. '</XS>'
  355.                         .. '<XO>' .. Objp.X.Offset .. '</XO>'
  356.                         .. '<YS>' .. Objp.Y.Scale .. '</YS>'
  357.                         .. '<YO>' .. Objp.Y.Offset .. '</YO>'
  358.                         .. '</UDim2>'
  359.                     elseif (Type == 'Color3') then
  360.                         Append =
  361.                             '<Color3 name="' .. ObjProp .. '">'
  362.                         .. '<R>' .. Objp.r .. '</R>'
  363.                         .. '<G>' .. Objp.g .. '</G>'
  364.                         .. '<B>' .. Objp.b .. '</B>'
  365.                         .. '</Color3>'
  366.                     elseif (Type == 'NumberRange') then
  367.                         Append =
  368.                             '<NumberRange name="' .. ObjProp .. '">'
  369.                         .. tostring(Objp.Min)
  370.                         .. ' '
  371.                         .. tostring(Objp.Max)
  372.                         .. '</NumberRange>'
  373.                     elseif (Type == 'NumberSequence') then
  374.                         local Ob    = {};
  375.  
  376.                         Ob[1]   = '<NumberSequence name="' .. ObjProp .. '">'
  377.  
  378.                         for i, v in next, Objp.Keypoints do
  379.                             Ob[#Ob + 1] = tostring(v.Time) .. ' ' .. tostring(v.Value) .. ' ' .. tostring(v.Envelope) .. ' ';
  380.                         end
  381.  
  382.                         Ob[#Ob + 1] = '</NumberSequence>';
  383.  
  384.                         Append = Concat(Ob);
  385.                     elseif (Type == 'ColorSequence') then
  386.                         local Ob    = {};
  387.  
  388.                         Ob[1]   = '<ColorSequence name="' .. ObjProp .. '">'
  389.  
  390.                         for i, v in next, Objp.Keypoints do
  391.                             Ob[#Ob + 1] = Concat{tostring(v.Time) .. ' ' .. tostring(v.Value.r) .. ' ' .. tostring(v.Value.g) .. ' ' .. tostring(v.Value.b), " 0 "};
  392.                         end
  393.  
  394.                         Ob[#Ob + 1] = '</ColorSequence>';
  395.  
  396.                         Append = Concat(Ob);
  397.                     elseif (Type == 'Rect2D') then
  398.                         Append =
  399.                             '<Rect2D name="' .. ObjProp .. '">'
  400.                         .. '<min>'
  401.                         .. '<X>' .. tostring(Objp.Min.X) .. '</X>'
  402.                         .. '<Y>' .. tostring(Objp.Min.Y) .. '</Y>'
  403.                         .. '</min>'
  404.                         .. '<max>'
  405.                         .. '<X>' .. tostring(Objp.Max.X) .. '</X>'
  406.                         .. '<Y>' .. tostring(Objp.Max.Y) .. '</Y>'
  407.                         .. '</max>'
  408.                         .. '</Rect2D>'
  409.                     elseif (Type == 'ProtectedString') then
  410.                         local Src;
  411.  
  412.                         if (ObjProp == 'Source') then
  413.                             if (Obj.ClassName ~= 'Script') then
  414.                                 local Sc, Er    = Decompile(Obj);
  415.  
  416.                                 if (not Sc) then
  417.                                     Src = '--[[\n\t' .. Er .. '\n--]]';
  418.                                 else
  419.                                     Src = Sc;
  420.                                 end;
  421.                             else
  422.                                 Src = '-- Server script not decompiled :(';
  423.                             end;
  424.                         else
  425.                             Src = '';
  426.                         end;
  427.  
  428.                         Append = '<ProtectedString name="' .. ObjProp .. '"><![CDATA[' .. Src .. ']]></ProtectedString>';
  429.                     elseif (Type == 'Object') then
  430.                         if (not Objp) then
  431.                             Objp    = 'null';
  432.                         else
  433.                             Objp    = 'RBX' .. Saved[Objp];
  434.                         end;
  435.  
  436.                         Append = '<Ref name="' .. ObjProp .. '">' .. Objp .. '</Ref>';
  437.                     elseif (Type == 'PhysicalProperties') then
  438.                         if Objp then
  439.                             Append =
  440.                                 '<PhysicalProperties name="' .. ObjProp .. '"><CustomPhysics>true</CustomPhysics>'
  441.                             .. '<Density>' .. tostring(Objp.Density) .. '</Density>'
  442.                             .. '<Friction>' .. tostring(Objp.Friction) .. '</Friction>'
  443.                             .. '<Elasticity>' .. tostring(Objp.Elasticity) .. '</Elasticity>'
  444.                             .. '<FrictionWeight>' .. tostring(Objp.FrictionWeight) .. '</FrictionWeight>'
  445.                             .. '<ElasticityWeight>' .. tostring(Objp.ElasticityWeight) .. '</ElasticityWeight>'
  446.                             .. '</PhysicalProperties>'
  447.                         else
  448.                             Append = '<PhysicalProperties name="' .. ObjProp .. '"><CustomPhysics>false</CustomPhysics></PhysicalProperties>';
  449.                         end;
  450.                     end;
  451.                 end;
  452.  
  453.                 if Append then
  454.                     Final[#Final + 1]   = Append;
  455.                 end;
  456.             end
  457.  
  458.             Final[#Final + 1]   = '</Properties>';
  459.  
  460.             for _, Obj in next, Obj:GetChildren() do
  461.                 SaveInstance(Obj);
  462.             end;
  463.  
  464.             Final[#Final + 1]   = '</Item>';
  465.         end;
  466.     end;
  467.  
  468.     do
  469.         local Other = Instance.new'Folder';
  470.  
  471.         local Real  = Players.LocalPlayer;
  472.         local Play  = Instance.new'Folder';
  473.  
  474.         Other.Name          = 'Other';
  475.         Other.RobloxLocked  = true;
  476.         Other.Parent        = game;
  477.  
  478.         Play.Parent         = Other;
  479.         Play.Name           = 'LocalPlayer';
  480.  
  481.         for _, Des in next, Real:GetChildren() do
  482.             pcall(SetParent, Des, Play);
  483.         end;
  484.  
  485.         if InNil then
  486.             local Extr  = Instance.new'Folder';
  487.  
  488.             Extr.Parent         = Other;
  489.             Extr.Name           = 'Nil_Instances';
  490.  
  491.             for _, Nil in next, InNil() do
  492.                 pcall(SetParent, Nil, Extr);
  493.             end;
  494.         end;
  495.  
  496.         SaveList[#SaveList + 1] = Other;
  497.     end;
  498.  
  499.     for _, Child in next, SaveList do
  500.         SaveInstance(Child);
  501.     end;
  502.  
  503.     Final[#Final + 1]   = '</roblox>';
  504.  
  505.     local Place = game:GetService('MarketplaceService'):GetProductInfo(game.PlaceId);
  506.  
  507.     if Place.Name then
  508.         local Illegal   = {'/', '\\', ':', '?', '"', '\'', '<', '>', '|'};
  509.  
  510.         for Idx = 1, #Illegal do
  511.             Illegal[Illegal[Idx]]   = '';
  512.  
  513.             Illegal[Idx]    = nil;
  514.         end;
  515.  
  516.         Place   = string.gsub(Place.Name, '.', Illegal);
  517.     else
  518.         Place   = 'Unknown';
  519.     end;
  520.  
  521.     Final = Concat(Final);
  522.  
  523.     Print(string.format('Done serializing, saving (%d bytes)', #Final));
  524.  
  525.     WritesFl(Place .. '.rbxl', Final);
  526.  
  527.     Print(string.format('Saving took %d second(s), please check your workspace folder', tick() - Timer));
  528. end;
  529.  
  530. SavePlaceAsync();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement