Advertisement
Technikmax

[SAVE SCRIPT REPORT] Roblox

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