Advertisement
ToxicWHOMakesGUIS

copy game

Jan 11th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.41 KB | None | 0 0
  1. local Classes; -- Author @Rerumu <3
  2. local Props = {}; --Edited by Doctor Derank to work
  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. -- Did some concatenation changes
  12. -- Also some other minor performance upgrades
  13. --- Synapse and Elysian individual support
  14. ---- Re-did Elysian callback stuff because it was slow
  15. ---- Added an Elysian fallback to LuaDec whenever needed
  16. ]]
  17.  
  18. local InNil;
  19. local Print;
  20. local WritesFl;
  21. local Decompile;
  22.  
  23. local NotFilter = (not workspace.FilteringEnabled); -- Bytecode used to replicate lol
  24. local SaveList = {
  25. game:GetService('Workspace');
  26. game:GetService('ReplicatedFirst');
  27. game:GetService('ReplicatedStorage');
  28. game:GetService('ServerStorage'); -- Internal stuff
  29. game:GetService('Lighting');
  30. game:GetService('StarterGui');
  31. game:GetService('StarterPack');
  32. game:GetService('StarterPlayer');
  33. game:GetService('Teams');
  34. game:GetService('InsertService');
  35. };
  36.  
  37. local IgnoredList = {
  38. 'CameraScript';
  39. 'ControlScript';
  40. 'ChatScript';
  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:HttpGetAsync('http://anaminus.github.io/rbx/json/api/latest.json');
  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 syn then -- Oh my god 3ds why couldn't you just use '.' syntax
  93. function InNil()
  94. return getnilinstances()
  95. end;
  96.  
  97. function WritesFl(Location, Data)
  98. return writefile(Location, Data)
  99. end;
  100.  
  101. function Decompile(Script)
  102. return '--decompiler is slow, removed right now :('
  103. end;
  104.  
  105. Print = warn;
  106.  
  107. Print('ReruSavePlace detected Synapse, functions loaded');
  108. else
  109. error('This exploit may not be supported by RSP, please contact me');
  110. end;
  111.  
  112. do
  113. local Temp = {};
  114.  
  115. for Idx, Val in next, Classes do
  116. if (Val.type == 'Class') then
  117. Temp[Val.Name] = Val;
  118. Temp[Val.Name].Properties = {};
  119. elseif (Val.type == 'Property') then
  120. local Ignore;
  121.  
  122. for _, Tag in next, Val.tags do
  123. if (Tag == 'deprecated') or (Tag == 'hidden') or (Tag == 'readonly') then
  124. Ignore = true;
  125.  
  126. break;
  127. end;
  128. end;
  129.  
  130. if (not Ignore) then
  131. local Ignored = NoNoProp[Val.Class];
  132.  
  133. if Ignored and Ignored[Val.Name] then
  134. Ignore = true;
  135. end;
  136.  
  137. if (not Ignore) then
  138. local Props = Temp[Val.Class].Properties;
  139.  
  140. Props[#Props + 1] = Val;
  141. end;
  142. end;
  143. end;
  144. end;
  145.  
  146. Classes = Temp;
  147. end;
  148.  
  149. local function PropsOf(Obj)
  150. if Props[Obj.ClassName] then
  151. return Props[Obj.ClassName];
  152. end;
  153.  
  154. local Prop = {};
  155. local Class = Obj.ClassName;
  156.  
  157. while Class do
  158. local Curr = Classes[Class];
  159.  
  160. for Index, Value in next, Curr.Properties do
  161. Prop[#Prop + 1] = Value;
  162. end;
  163.  
  164. Class = Curr.Superclass;
  165. end;
  166.  
  167. table.sort(Prop, function(A, B)
  168. return A.Name < B.Name;
  169. end);
  170.  
  171. Props[Obj.ClassName] = Prop;
  172.  
  173. return Prop;
  174. end;
  175.  
  176. local function SetParent(Obj, Parent)
  177. local Arch = Obj.Archivable;
  178. local Cloned;
  179.  
  180. Obj.Archivable = true;
  181. Cloned = Obj:Clone();
  182.  
  183. if (not Cloned) then
  184. local pcall = pcall;
  185.  
  186. Cloned = Instance.new'Folder'
  187.  
  188. for Index, Child in next, Obj:GetChildren() do
  189. pcall(SetParent, Child, Cloned);
  190. end;
  191.  
  192. Cloned.Name = Obj.Name .. ':' .. Obj.ClassName;
  193. end;
  194.  
  195. Obj.Archivable = Arch;
  196. Cloned.Parent = Parent;
  197. end;
  198.  
  199. local function SavePlaceAsync()
  200. local Count = 0;
  201. local Final = {};
  202. local Timer = tick();
  203. local Saved = setmetatable({}, {__index = function(This, Idx) local C = Count + 1; Count = C; This[Idx] = C; return C; end});
  204.  
  205. local pcall = pcall; -- Skid syndrome
  206.  
  207. 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>';
  208. Print('Saving place...');
  209.  
  210. local function SaveInstance(Obj)
  211. if Classes[Obj.ClassName] and (not IgnoredList[Obj.Name]) then
  212. local Props = PropsOf(Obj);
  213. local Num = Saved[Obj];
  214. local Conversions = {
  215. ['&'] = '&amp;';
  216. ['<'] = '&lt;';
  217. ['>'] = '&gt;';
  218. }
  219.  
  220. Final[#Final + 1] = '<Item class="' .. Obj.ClassName .. '" referent="RBX' .. Num .. '"><Properties>';
  221.  
  222. if Num % 100 == 0 then
  223. Print('Reached ' .. Num .. ' instances saved');
  224.  
  225. Beat:wait();
  226. Beat:wait();
  227. end
  228.  
  229. for _, Prop in next, Props do
  230. local Append;
  231. local Type = Prop.ValueType;
  232. local ObjProp = Prop.Name;
  233. if ObjProp ~= "TemporaryLegacyPhysicsSolverOverride" then
  234. local Objp = Obj[ObjProp];
  235.  
  236. if (typeof(Objp) == 'EnumItem') then
  237. Append = '<token name="' .. ObjProp .. '">' .. Objp.Value .. '</token>';
  238. else
  239. if (Type == 'bool') then
  240. Append = '<bool name="' .. ObjProp .. '">' .. tostring(Objp) .. '</bool>';
  241. elseif (Type == 'float') then
  242. Append = '<float name="' .. ObjProp .. '">' .. tostring(Objp) .. '</float>';
  243. elseif (Type == 'int') then
  244. Append = '<int name="' .. ObjProp .. '">' .. tostring(Objp) .. '</int>';
  245. elseif (Type == 'double') then
  246. Append = '<float name="' .. ObjProp .. '">' .. tostring(Objp) .. '</float>';
  247. elseif (Type == 'string') then
  248. local String = Objp:gsub("[&<>]", Conversions); -- Because I got C O M P L A I N T S
  249.  
  250. Append = '<string name="' .. ObjProp .. '">' .. String .. '</string>';
  251. elseif (Type == 'BrickColor') then
  252. Append = '<int name="' .. ObjProp .. '">' .. Objp.Number .. '</int>';
  253. elseif (Type == 'Vector2') then
  254. Append =
  255. '<Vector2 name="' .. ObjProp .. '">'
  256. .. '<X>' .. Objp.x .. '</X>'
  257. .. '<Y>' .. Objp.y .. '</Y>'
  258. .. '</Vector2>'
  259. elseif (Type == 'Vector3') then
  260. Append =
  261. '<Vector3 name="' .. ObjProp .. '">'
  262. .. '<X>' .. Objp.x .. '</X>'
  263. .. '<Y>' .. Objp.y .. '</Y>'
  264. .. '<Z>' .. Objp.z .. '</Z>'
  265. .. '</Vector3>'
  266. elseif (Type == 'CoordinateFrame') then
  267. local X, Y, Z, R00, R01, R02, R10, R11, R12, R20, R21, R22 = Objp:components()
  268.  
  269. Append =
  270. '<CoordinateFrame name="' .. ObjProp .. '">'
  271. .. '<X>' .. X .. '</X>'
  272. .. '<Y>' .. Y .. '</Y>'
  273. .. '<Z>' .. Z .. '</Z>'
  274. .. '<R00>' .. R00 .. '</R00>'
  275. .. '<R01>' .. R01 .. '</R01>'
  276. .. '<R02>' .. R02 .. '</R02>'
  277. .. '<R10>' .. R10 .. '</R10>'
  278. .. '<R11>' .. R11 .. '</R11>'
  279. .. '<R12>' .. R12 .. '</R12>'
  280. .. '<R20>' .. R20 .. '</R20>'
  281. .. '<R21>' .. R21 .. '</R21>'
  282. .. '<R22>' .. R22 .. '</R22>'
  283. .. '</CoordinateFrame>'
  284. elseif (Type == 'Content') then
  285. local String = Objp:gsub("[&<>]", Conversions);
  286.  
  287. Append = '<Content name="' .. ObjProp .. '"><url>' .. String .. '</url></Content>';
  288. elseif (Type == 'UDim2') then
  289. local Objp = Objp;
  290.  
  291. Append =
  292. '<UDim2 name="' .. ObjProp .. '">'
  293. .. '<XS>' .. Objp.X.Scale .. '</XS>'
  294. .. '<XO>' .. Objp.X.Offset .. '</XO>'
  295. .. '<YS>' .. Objp.Y.Scale .. '</YS>'
  296. .. '<YO>' .. Objp.Y.Offset .. '</YO>'
  297. .. '</UDim2>'
  298. elseif (Type == 'Color3') then
  299. Append =
  300. '<Color3 name="' .. ObjProp .. '">'
  301. .. '<R>' .. Objp.r .. '</R>'
  302. .. '<G>' .. Objp.g .. '</G>'
  303. .. '<B>' .. Objp.b .. '</B>'
  304. .. '</Color3>'
  305. elseif (Type == 'NumberRange') then
  306. Append =
  307. '<NumberRange name="' .. ObjProp .. '">'
  308. .. tostring(Objp.Min)
  309. .. ' '
  310. .. tostring(Objp.Max)
  311. .. '</NumberRange>'
  312. elseif (Type == 'NumberSequence') then
  313. local Ob = {};
  314.  
  315. Ob[1] = '<NumberSequence name="' .. ObjProp .. '">'
  316.  
  317. for i, v in next, Objp.Keypoints do
  318. Ob[#Ob + 1] = tostring(v.Time) .. ' ' .. tostring(v.Value) .. ' ' .. tostring(v.Envelope) .. ' ';
  319. end
  320.  
  321. Ob[#Ob + 1] = '</NumberSequence>';
  322.  
  323. Append = Concat(Ob);
  324. elseif (Type == 'ColorSequence') then
  325. local Ob = {};
  326.  
  327. Ob[1] = '<ColorSequence name="' .. ObjProp .. '">'
  328.  
  329. for i, v in next, Objp.Keypoints do
  330. Ob[#Ob + 1] = Concat{tostring(v.Time) .. ' ' .. tostring(v.Value.r) .. ' ' .. tostring(v.Value.g) .. ' ' .. tostring(v.Value.b), " 0 "};
  331. end
  332.  
  333. Ob[#Ob + 1] = '</ColorSequence>';
  334.  
  335. Append = Concat(Ob);
  336. elseif (Type == 'Rect2D') then
  337. Append =
  338. '<Rect2D name="' .. ObjProp .. '">'
  339. .. '<min>'
  340. .. '<X>' .. tostring(Objp.Min.X) .. '</X>'
  341. .. '<Y>' .. tostring(Objp.Min.Y) .. '</Y>'
  342. .. '</min>'
  343. .. '<max>'
  344. .. '<X>' .. tostring(Objp.Max.X) .. '</X>'
  345. .. '<Y>' .. tostring(Objp.Max.Y) .. '</Y>'
  346. .. '</max>'
  347. .. '</Rect2D>'
  348. elseif (Type == 'ProtectedString') then
  349. local Src;
  350.  
  351. if (ObjProp == 'Source') then
  352. if (Obj.ClassName ~= 'Script') or NotFilter then
  353. local Sc, Er = Decompile(Obj);
  354.  
  355. if (not Sc) then
  356. Src = '--[[\n\t' .. Er .. '\n--]]';
  357. else
  358. Src = Sc;
  359. end;
  360. else
  361. Src = '-- Server script not decompiled :(';
  362. end;
  363. else
  364. Src = '';
  365. end;
  366.  
  367. Append = '<ProtectedString name="' .. ObjProp .. '"><![CDATA[' .. Src .. ']]></ProtectedString>';
  368. elseif (Type == 'Object') then
  369. if (not Objp) then
  370. Objp = 'null';
  371. else
  372. Objp = 'RBX' .. Saved[Objp];
  373. end;
  374.  
  375. Append = '<Ref name="' .. ObjProp .. '">' .. Objp .. '</Ref>';
  376. elseif (Type == 'PhysicalProperties') then
  377. if Objp then
  378. Append =
  379. '<PhysicalProperties name="' .. ObjProp .. '"><CustomPhysics>true</CustomPhysics>'
  380. .. '<Density>' .. tostring(Objp.Density) .. '</Density>'
  381. .. '<Friction>' .. tostring(Objp.Friction) .. '</Friction>'
  382. .. '<Elasticity>' .. tostring(Objp.Elasticity) .. '</Elasticity>'
  383. .. '<FrictionWeight>' .. tostring(Objp.FrictionWeight) .. '</FrictionWeight>'
  384. .. '<ElasticityWeight>' .. tostring(Objp.ElasticityWeight) .. '</ElasticityWeight>'
  385. .. '</PhysicalProperties>'
  386. else
  387. Append = '<PhysicalProperties name="' .. ObjProp .. '"><CustomPhysics>false</CustomPhysics></PhysicalProperties>';
  388. end;
  389. end;
  390. end;
  391.  
  392. if Append then
  393. Final[#Final + 1] = Append;
  394. end;
  395. end;
  396. end
  397.  
  398. Final[#Final + 1] = '</Properties>';
  399.  
  400. for _, Obj in next, Obj:GetChildren() do
  401. SaveInstance(Obj);
  402. end;
  403.  
  404. Final[#Final + 1] = '</Item>';
  405. end;
  406. end;
  407.  
  408. do
  409. local Real = Players.LocalPlayer;
  410. local Serv = game:GetService('ServerStorage');
  411. local Play = Instance.new'Folder';
  412.  
  413. Play.Parent = Serv;
  414. Play.Name = 'LocalPlayer';
  415.  
  416. for _, Des in next, Real:GetChildren() do
  417. pcall(SetParent, Des, Play);
  418. end;
  419.  
  420. if InNil then
  421. local Extr = Instance.new'Folder';
  422.  
  423. Extr.Parent = Serv;
  424. Extr.Name = 'Nil_Instances';
  425.  
  426. for _, Nil in next, InNil() do
  427. pcall(SetParent, Nil, Extr);
  428. end;
  429. end;
  430. end;
  431.  
  432. for _, Child in next, SaveList do
  433. SaveInstance(Child);
  434. end;
  435.  
  436. Final[#Final + 1] = '</roblox>';
  437.  
  438. local Place = game:GetService('MarketplaceService'):GetProductInfo(game.PlaceId);
  439.  
  440. if Place.Name then
  441. local Illegal = {'/', '\\', ':', '?', '"', '\'', '<', '>', '|'};
  442.  
  443. for Idx = 1, #Illegal do
  444. Illegal[Illegal[Idx]] = '';
  445.  
  446. Illegal[Idx] = nil;
  447. end;
  448.  
  449. Place = string.gsub(Place.Name, '.', Illegal);
  450. else
  451. Place = 'Unknown';
  452. end;
  453.  
  454. Print('Done serializing, writing to file');
  455.  
  456. wait(5)
  457.  
  458. WritesFl(Place .. '.rbxlx', Concat(Final));
  459.  
  460. Print(string.format('Saving took %d second(s), please check your workspace folder', tick() - Timer));
  461. end;
  462.  
  463. SavePlaceAsync();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement