Advertisement
SlyHades66

Game_Copier

Mar 10th, 2017
440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.94 KB | None | 0 0
  1. local Return = ""
  2.  
  3. local DecompileScripts = false
  4.  
  5. function CreateInstance(Object)
  6.     local Name = string.gsub(Object.Name, " ", "_")
  7.     Return = Return.."local "..Name.." = Instance.new('"..tostring(Object.ClassName).."')\n"..Name..".Size = Vector3.new("..tostring(Object.Size.X)..", "..tostring(Object.Size.Y)..", "..tostring(Object.Size.Z)..")\n"..Name..".Position = CFrame.new("..tostring(Object.Position.X)..", "..tostring(Object.Position.Y)..", "..tostring(Object.Position.Z)..")\n"..Name..".BrickColor = BrickColor.new('"..tostring(Object.BrickColor).."')\n"..Name..".TopSurface = "..tostring(Object.TopSurface).."\n"..Name..".BottomSurface = "..tostring(Object.BottomSurface).."\n"..Name..".BackSurface = "..tostring(Object.BackSurface).."\n"..Name..".FrontSurface = "..tostring(Object.FrontSurface).."\n"..Name..".LeftSurface = "..tostring(Object.LeftSurface).."\n"..Name..".RightSurface = "..tostring(Object.RightSurface).."\n"..Name..".CanCollide = "..tostring(Object.CanCollide).."\n"..Name..".Anchored = "..tostring(Object.Anchored).."\n"..Name..".Name = '"..Name.."'\n"..Name..".Parent = game.Workspace\n\n"
  8. end
  9.  
  10. function CreateScript(Object)
  11.     local Name = string.gsub(Object.Name, " ", "_")
  12.     Return = Return.."local "..Name.." = Instance.new('"..tostring(Object.ClassName).."')\n"..Name..".Name = '"..Name.."'\n"..Name..".Source = [["..tostring(decompile(Object)).."]]\n"..Name..".Parent = game.Workspace\n\n"
  13. end
  14.  
  15. function Recursive(Object)
  16.     wait()
  17.     for _,Part in pairs(Object:GetChildren()) do
  18.         if Part:IsA("BasePart") and Part.Name ~= "Terrain" then
  19.             CreateInstance(Part)
  20.         elseif Part:IsA("LocalScript") and DecompileScripts or Part:IsA("ModuleScript") and DecompileScripts then
  21.             CreateScript(Part)
  22.         end
  23.         Recursive(Part)
  24.     end
  25. end
  26.  
  27. local Cloning = Recursive(game.Workspace)
  28.  
  29. repeat wait() until not Cloning
  30.  
  31. local Cloning2 = Recursive(game.Players.LocalPlayer)
  32.  
  33. repeat wait() until not Cloning2
  34. warn("Done Cloning")
  35. copystr(Return)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement