Advertisement
ApexdaUser

this does Not work yet!!!

Dec 30th, 2023 (edited)
879
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.29 KB | None | 0 0
  1. -- Delta Custom Save-Instance (THIS DOES NOT WORK YET!!!)
  2. -- This script does NOT save the instance that you put! It will save the descendants and put it in a folder in Workspace!
  3. -- Made with love by zuzaratrust <3
  4.  
  5. -- Options
  6. local instance = game.ReplicatedFirst -- The instance to save descendants from
  7. -- more to be added later
  8. -- End Options
  9.  
  10. -- Don't touch this code!!!!!!!!!!!!!!!!!!
  11.  
  12. local xml = [[<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">
  13. ]]
  14. local curdata = [[]]
  15. local parts = {}
  16. local subitems = {}
  17. local data
  18. data = game:HttpGet("https://setup.rbxcdn.com/versionQTStudio", true)
  19. data = game:HttpGet("http://setup.rbxcdn.com/"..data.."-API-Dump.json", true)
  20. data = game:GetService("HttpService"):JSONDecode(data)
  21. data = data["Classes"]
  22. function propertyLookup(itype)
  23.     print("Requested Type:", itype)
  24.     local properties = {}
  25.     local supersearch
  26.     for i,v in pairs(data) do
  27.         for k,j in pairs(v["Members"]) do
  28.             if j["MemberType"] == "Property" and v["Name"] == itype then
  29.                 table.insert(properties, j)
  30.             end
  31.             if v["Superclass"] and v["Name"] == itype then
  32.                 supersearch = v["Superclass"]
  33.             end
  34.         end
  35.     end
  36.     if supersearch then
  37.         for i,v in pairs(data) do
  38.             for k,j in pairs(v["Members"]) do
  39.                 if j["MemberType"] == "Property" and v["Name"] == supersearch then
  40.                     table.insert(properties, j)
  41.                 end
  42.             end
  43.         end
  44.     end
  45.     return properties
  46. end
  47. local cfrcomp = {"X","Y","Z","R00","R01","R02","R10","R11","R12","R20","R21","R22"}
  48. print("Initialized variables, starting child loop.")
  49. for i,v in pairs(instance:GetDescendants()) do
  50. curdata ..= "<Item class=\"" .. v.ClassName .. "\" referent=\"" .. (#parts+1) .. "\">\n"
  51. curdata ..= "<Properties>\n"
  52. table.insert(parts, v)
  53. local properties = propertyLookup(v.ClassName)
  54. for j,k in pairs(properties) do
  55. pcall(function()
  56. if (v[k["Name"]] and not v:FindFirstChild(k["Name"])) then
  57. print(k["Name"])
  58. curdata ..= "<"..(k["ValueType"]["Name"] == "BrickColor" and "int" or (k["ValueType"]["Name"] == "Enum" and "token" or (k["ValueType"]["Name"] == "CFrame" and "CoordinateFrame" or k["ValueType"]["Name"]))).." name=\""..k["Name"].."\">"
  59. if k["Name"] == "CFrame" then
  60. for z,x in pairs(table.pack(v["CFrame"]:GetComponents())) do
  61. if z ~= "n" then
  62. curdata ..= "<"..cfrcomp[z]..">"..x.."</"..cfrcomp[z]..">"
  63. end
  64. end
  65. else
  66. curdata ..= v[k["Name"]] .. ""
  67. end
  68. curdata ..= "</"..(k["ValueType"]["Name"] == "BrickColor" and "int" or (k["ValueType"]["Name"] == "Enum" and "token" or (k["ValueType"]["Name"] == "CFrame" and "CoordinateFrame" or k["ValueType"]["Name"])))..">\n"
  69. end
  70. table.insert(subitems,curdata)
  71. end)
  72. curdata = ""
  73. end
  74. end
  75. print("Done looping through children")
  76. xml ..= [[<Item class="Workspace" referent="mainworkspace">
  77. <Properties>
  78. </Properties>
  79. <Item class="Folder" referent="mainfolder">
  80. <Properties>
  81. </Properties>
  82. ]]
  83. print("Looping through subitems to add to main folder.")
  84. for i,v in pairs(subitems) do
  85. xml ..= v
  86. xml ..= "</Properties>\n"
  87. xml ..= "</Item>\n"
  88. end
  89. xml ..= [[</Properties>
  90. </Item>
  91. </Item>
  92. </Item>
  93. </roblox>]]
  94. print("Done!")
  95. print("(temp action) Printing output XML...")
  96. print(xml)
  97. print("Copying to Clipboard...")
  98. setclipboard(xml)
  99. print("Done!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement