Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local copyWhat = {"Workspace","Lighting","ReplicatedStorage","ReplicatedFirst","StarterPack","StarterGui","StarterPlayer"}
- local copyGroup = Instance.new("Model",game.ReplicatedStorage)
- local copyScripts = true
- local copyTerrain = true
- local lightingProperties = true
- local cameraInstances = true
- -----------------------------------------------------------------------------------
- local consoleFunc = printconsole or writeconsole
- if consoleFunc then
- consoleFunc("Raspberry Pi & Moon's place copier loaded.")
- consoleFunc("Copying map of game "..tostring(game.PlaceId)..".")
- end
- function archivable(root)
- for i,v in pairs(root:GetChildren()) do
- if not game.Players:GetPlayerFromCharacter(v) then
- v.Archivable = true
- archivable(v)
- end
- end
- end
- function decompileS(root)
- for i,v in pairs(root:GetChildren()) do
- pcall(function()
- if v:IsA("LocalScript") then
- local isDisabled = v.Disabled
- v.Disabled = true
- v.Source = decompile(v)
- v.Disabled = isDisabled
- if v.Source == "" then
- if consoleFunc then consoleFunc("LocalScript "..v.Name.." had a problem decompiling.") end
- else
- if consoleFunc then consoleFunc("LocalScript "..v.Name.." decompiled.") end
- end
- elseif v:IsA("ModuleScript") then
- v.Source = decompile(v)
- if v.Source == "" then
- if consoleFunc then consoleFunc("ModuleScript "..v.Name.." had a problem decompiling.") end
- else
- if consoleFunc then consoleFunc("ModuleScript "..v.Name.." decompiled.") end
- end
- end
- end)
- decompileS(v)
- end
- end
- for i,v in pairs(copyWhat) do archivable(game[v]) end
- for j,obj in pairs(copyWhat) do
- if obj ~= "StarterPlayer" then
- local newFolder = Instance.new("Folder",copyGroup)
- newFolder.Name = obj
- for i,v in pairs(game[obj]:GetChildren()) do
- if v ~= copyGroup then
- pcall(function()
- v:Clone().Parent = newFolder
- end)
- end
- end
- else
- local newFolder = Instance.new("Model",copyGroup)
- newFolder.Name = "StarterPlayer"
- for i,v in pairs(game[obj]:GetChildren()) do
- local newObj = Instance.new("Folder",newFolder)
- newObj.Name = v.Name
- for _,c in pairs(v:GetChildren()) do
- if c.Name ~= "ControlScript" and c.Name ~= "CameraScript" then
- c:Clone().Parent = newObj
- end
- end
- end
- end
- end
- if workspace.CurrentCamera and cameraInstances then
- local cameraFolder = Instance.new("Model",copyGroup)
- cameraFolder.Name = "CameraItems"
- for i,v in pairs(workspace.CurrentCamera:GetChildren()) do v:Clone().Parent = cameraFolder end
- end
- if copyTerrain then
- local myTerrain = workspace.Terrain:CopyRegion(workspace.Terrain.MaxExtents)
- myTerrain.Parent = copyGroup
- end
- function saveProp(obj,prop,par)
- local myProp = obj[prop]
- if type(myProp) == "boolean" then
- local newProp = Instance.new("BoolValue",par)
- newProp.Name = prop
- newProp.Value = myProp
- elseif type(myProp) == "number" then
- local newProp = Instance.new("IntValue",par)
- newProp.Name = prop
- newProp.Value = myProp
- elseif type(myProp) == "string" then
- local newProp = Instance.new("StringValue",par)
- newProp.Name = prop
- newProp.Value = myProp
- elseif type(myProp) == "userdata" then -- Assume Color3
- pcall(function()
- local newProp = Instance.new("Color3Value",par)
- newProp.Name = prop
- newProp.Value = myProp
- end)
- end
- end
- if lightingProperties then
- local lightingProps = Instance.new("Model",copyGroup)
- lightingProps.Name = "LightingProperties"
- saveProp(game.Lighting,"Ambient",lightingProps)
- saveProp(game.Lighting,"Brightness",lightingProps)
- saveProp(game.Lighting,"ColorShift_Bottom",lightingProps)
- saveProp(game.Lighting,"ColorShift_Top",lightingProps)
- saveProp(game.Lighting,"GlobalShadows",lightingProps)
- saveProp(game.Lighting,"OutdoorAmbient",lightingProps)
- saveProp(game.Lighting,"Outlines",lightingProps)
- saveProp(game.Lighting,"GeographicLatitude",lightingProps)
- saveProp(game.Lighting,"TimeOfDay",lightingProps)
- saveProp(game.Lighting,"FogColor",lightingProps)
- saveProp(game.Lighting,"FogEnd",lightingProps)
- saveProp(game.Lighting,"FogStart",lightingProps)
- end
- if decompile and copyScripts then
- decompileS(copyGroup)
- end
- if SInstance then
- elseif _G.SInstance then
- _G.SInstance(copyGroup,tostring(game.PlaceId).."MapCopy"..".rbxm")
- end
- --print("Saved!")
- if consoleFunc then
- consoleFunc("The map has been copied.")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement