Advertisement
Shrektella

Untitled

Jan 16th, 2017
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.50 KB | None | 0 0
  1. local copyWhat = {"Workspace","Lighting","ReplicatedStorage","ReplicatedFirst","StarterPack","StarterGui","StarterPlayer"}
  2.  
  3. local copyGroup = Instance.new("Model",game.ReplicatedStorage)
  4.  
  5. local copyScripts = true
  6.  
  7. local copyTerrain = true
  8.  
  9. local lightingProperties = true
  10.  
  11. local cameraInstances = true
  12.  
  13. -----------------------------------------------------------------------------------
  14.  
  15. local consoleFunc = printconsole or writeconsole
  16.  
  17. if consoleFunc then
  18. consoleFunc("Raspberry Pi & Moon's place copier loaded.")
  19. consoleFunc("Copying map of game "..tostring(game.PlaceId)..".")
  20. end
  21.  
  22. function archivable(root)
  23. for i,v in pairs(root:GetChildren()) do
  24. if not game.Players:GetPlayerFromCharacter(v) then
  25. v.Archivable = true
  26. archivable(v)
  27. end
  28. end
  29. end
  30.  
  31. function decompileS(root)
  32. for i,v in pairs(root:GetChildren()) do
  33. pcall(function()
  34. if v:IsA("LocalScript") then
  35. local isDisabled = v.Disabled
  36. v.Disabled = true
  37. v.Source = decompile(v)
  38. v.Disabled = isDisabled
  39.  
  40. if v.Source == "" then
  41. if consoleFunc then consoleFunc("LocalScript "..v.Name.." had a problem decompiling.") end
  42. else
  43. if consoleFunc then consoleFunc("LocalScript "..v.Name.." decompiled.") end
  44. end
  45. elseif v:IsA("ModuleScript") then
  46. v.Source = decompile(v)
  47.  
  48. if v.Source == "" then
  49. if consoleFunc then consoleFunc("ModuleScript "..v.Name.." had a problem decompiling.") end
  50. else
  51. if consoleFunc then consoleFunc("ModuleScript "..v.Name.." decompiled.") end
  52. end
  53. end
  54. end)
  55. decompileS(v)
  56. end
  57. end
  58.  
  59. for i,v in pairs(copyWhat) do archivable(game[v]) end
  60.  
  61. for j,obj in pairs(copyWhat) do
  62. if obj ~= "StarterPlayer" then
  63. local newFolder = Instance.new("Folder",copyGroup)
  64. newFolder.Name = obj
  65. for i,v in pairs(game[obj]:GetChildren()) do
  66. if v ~= copyGroup then
  67. pcall(function()
  68. v:Clone().Parent = newFolder
  69. end)
  70. end
  71. end
  72. else
  73. local newFolder = Instance.new("Model",copyGroup)
  74. newFolder.Name = "StarterPlayer"
  75. for i,v in pairs(game[obj]:GetChildren()) do
  76. local newObj = Instance.new("Folder",newFolder)
  77. newObj.Name = v.Name
  78. for _,c in pairs(v:GetChildren()) do
  79. if c.Name ~= "ControlScript" and c.Name ~= "CameraScript" then
  80. c:Clone().Parent = newObj
  81. end
  82. end
  83. end
  84. end
  85. end
  86.  
  87. if workspace.CurrentCamera and cameraInstances then
  88. local cameraFolder = Instance.new("Model",copyGroup)
  89. cameraFolder.Name = "CameraItems"
  90. for i,v in pairs(workspace.CurrentCamera:GetChildren()) do v:Clone().Parent = cameraFolder end
  91. end
  92.  
  93. if copyTerrain then
  94. local myTerrain = workspace.Terrain:CopyRegion(workspace.Terrain.MaxExtents)
  95. myTerrain.Parent = copyGroup
  96. end
  97.  
  98. function saveProp(obj,prop,par)
  99. local myProp = obj[prop]
  100. if type(myProp) == "boolean" then
  101. local newProp = Instance.new("BoolValue",par)
  102. newProp.Name = prop
  103. newProp.Value = myProp
  104. elseif type(myProp) == "number" then
  105. local newProp = Instance.new("IntValue",par)
  106. newProp.Name = prop
  107. newProp.Value = myProp
  108. elseif type(myProp) == "string" then
  109. local newProp = Instance.new("StringValue",par)
  110. newProp.Name = prop
  111. newProp.Value = myProp
  112. elseif type(myProp) == "userdata" then -- Assume Color3
  113. pcall(function()
  114. local newProp = Instance.new("Color3Value",par)
  115. newProp.Name = prop
  116. newProp.Value = myProp
  117. end)
  118. end
  119. end
  120.  
  121. if lightingProperties then
  122. local lightingProps = Instance.new("Model",copyGroup)
  123. lightingProps.Name = "LightingProperties"
  124.  
  125. saveProp(game.Lighting,"Ambient",lightingProps)
  126. saveProp(game.Lighting,"Brightness",lightingProps)
  127. saveProp(game.Lighting,"ColorShift_Bottom",lightingProps)
  128. saveProp(game.Lighting,"ColorShift_Top",lightingProps)
  129. saveProp(game.Lighting,"GlobalShadows",lightingProps)
  130. saveProp(game.Lighting,"OutdoorAmbient",lightingProps)
  131. saveProp(game.Lighting,"Outlines",lightingProps)
  132. saveProp(game.Lighting,"GeographicLatitude",lightingProps)
  133. saveProp(game.Lighting,"TimeOfDay",lightingProps)
  134. saveProp(game.Lighting,"FogColor",lightingProps)
  135. saveProp(game.Lighting,"FogEnd",lightingProps)
  136. saveProp(game.Lighting,"FogStart",lightingProps)
  137. end
  138.  
  139. if decompile and copyScripts then
  140. decompileS(copyGroup)
  141. end
  142.  
  143. if SInstance then
  144. elseif _G.SInstance then
  145. _G.SInstance(copyGroup,tostring(game.PlaceId).."MapCopy"..".rbxm")
  146. end
  147. --print("Saved!")
  148. if consoleFunc then
  149. consoleFunc("The map has been copied.")
  150. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement