Advertisement
tyridge77

Untitled

Jul 22nd, 2015
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.07 KB | None | 0 0
  1.  
  2. objects = {
  3.     ["Part"] = {
  4.         BrickColor = BrickColor.new("Medium stone grey"),
  5.         Material = Enum.Material.Plastic,
  6.         Reflectance = 0,
  7.         Transparency = 0,
  8.         Name = "Part",
  9.         CFrame = CFrame.new(Vector3.new(0, 0, 0)),
  10.         RotVelocity = Vector3.new(0, 0, 0),
  11.         Velocity = Vector3.new(0, 0, 0),
  12.         Anchored = false,
  13.         Archivable = true,
  14.         CanCollide = true,
  15.         Locked = false,
  16.         Elasticity = 0.5,
  17.         FormFactor = Enum.FormFactor.Brick,
  18.         Friction = 0.30000001192093,
  19.         Shape = "Block",
  20.         Size = Vector3.new(4, 1.2, 2),
  21.         BackParamA = -0.5,
  22.         BackParamB = 0.5,
  23.         BackSurfaceInput = Enum.InputType.NoInput,
  24.         BottomParamA = -0.5,
  25.         BottomParamB = 0.5,
  26.         BottomSurfaceInput = Enum.InputType.NoInput,
  27.         FrontParamA = -0.5,
  28.         FrontParamB = 0.5,
  29.         FrontSurfaceInput = Enum.InputType.NoInput,
  30.         LeftParamA = -0.5,
  31.         LeftParamB = 0.5,
  32.         LeftSurfaceInput = Enum.InputType.NoInput,
  33.         RightParamA = -0.5,
  34.         RightParamB = 0.5,
  35.         RightSurfaceInput = Enum.InputType.NoInput,
  36.         TopParamA = -0.5,
  37.         TopParamB = 0.5,
  38.         TopSurfaceInput = Enum.InputType.NoInput,
  39.         BackSurface = Enum.SurfaceType.Smooth,
  40.         BottomSurface = Enum.SurfaceType.Inlet,
  41.         FrontSurface = Enum.SurfaceType.Smooth,
  42.         LeftSurface = Enum.SurfaceType.Smooth,
  43.         RightSurface = Enum.SurfaceType.Smooth,
  44.         TopSurface = Enum.SurfaceType.Studs,
  45.     },
  46.     ["Seat"] = {
  47.         BrickColor = BrickColor.new("Medium stone grey"),
  48.         Material = Enum.Material.Plastic,
  49.         Reflectance = 0,
  50.         Transparency = 0,
  51.         Name = "Seat",
  52.         CFrame = CFrame.new(Vector3.new(0, 0, 0)),
  53.         RotVelocity = Vector3.new(0, 0, 0),
  54.         Velocity = Vector3.new(0, 0, 0),
  55.         Anchored = false,
  56.         Archivable = true,
  57.         CanCollide = true,
  58.         Locked = false,
  59.         Elasticity = 0.5,
  60.         FormFactor = Enum.FormFactor.Brick,
  61.         Friction = 0.30000001192093,
  62.         Shape = "Block",
  63.         Size = Vector3.new(4, 1.2, 2),
  64.         BackParamA = -0.5,
  65.         BackParamB = 0.5,
  66.         BackSurfaceInput = Enum.InputType.NoInput,
  67.         BottomParamA = -0.5,
  68.         BottomParamB = 0.5,
  69.         BottomSurfaceInput = Enum.InputType.NoInput,
  70.         FrontParamA = -0.5,
  71.         FrontParamB = 0.5,
  72.         FrontSurfaceInput = Enum.InputType.NoInput,
  73.         LeftParamA = -0.5,
  74.         LeftParamB = 0.5,
  75.         LeftSurfaceInput = Enum.InputType.NoInput,
  76.         RightParamA = -0.5,
  77.         RightParamB = 0.5,
  78.         RightSurfaceInput = Enum.InputType.NoInput,
  79.         TopParamA = -0.5,
  80.         TopParamB = 0.5,
  81.         TopSurfaceInput = Enum.InputType.NoInput,
  82.         BackSurface = Enum.SurfaceType.Smooth,
  83.         BottomSurface = Enum.SurfaceType.Inlet,
  84.         FrontSurface = Enum.SurfaceType.Smooth,
  85.         LeftSurface = Enum.SurfaceType.Smooth,
  86.         RightSurface = Enum.SurfaceType.Smooth,
  87.         TopSurface = Enum.SurfaceType.Studs,
  88.         Disabled = false,
  89.     },
  90.     ["VehicleSeat"] = {
  91.         BrickColor = BrickColor.new("Medium stone grey"),
  92.         Material = Enum.Material.Plastic,
  93.         Reflectance = 0,
  94.         Transparency = 0,
  95.         Name = "VehicleSeat",
  96.         CFrame = CFrame.new(Vector3.new(0, 0, 0)),
  97.         RotVelocity = Vector3.new(0, 0, 0),
  98.         Velocity = Vector3.new(0, 0, 0),
  99.         Anchored = false,
  100.         Archivable = true,
  101.         CanCollide = true,
  102.         Locked = false,
  103.         Elasticity = 0.5,
  104.         Friction = 0.30000001192093,
  105.         Size = Vector3.new(4, 1.2, 2),
  106.         BackParamA = -0.5,
  107.         BackParamB = 0.5,
  108.         BackSurfaceInput = Enum.InputType.NoInput,
  109.         BottomParamA = -0.5,
  110.         BottomParamB = 0.5,
  111.         BottomSurfaceInput = Enum.InputType.NoInput,
  112.         FrontParamA = -0.5,
  113.         FrontParamB = 0.5,
  114.         FrontSurfaceInput = Enum.InputType.NoInput,
  115.         LeftParamA = -0.5,
  116.         LeftParamB = 0.5,
  117.         LeftSurfaceInput = Enum.InputType.NoInput,
  118.         RightParamA = -0.5,
  119.         RightParamB = 0.5,
  120.         RightSurfaceInput = Enum.InputType.NoInput,
  121.         TopParamA = -0.5,
  122.         TopParamB = 0.5,
  123.         TopSurfaceInput = Enum.InputType.NoInput,
  124.         BackSurface = Enum.SurfaceType.Smooth,
  125.         BottomSurface = Enum.SurfaceType.Inlet,
  126.         FrontSurface = Enum.SurfaceType.Smooth,
  127.         LeftSurface = Enum.SurfaceType.Smooth,
  128.         RightSurface = Enum.SurfaceType.Smooth,
  129.         TopSurface = Enum.SurfaceType.Studs,
  130.         Disabled = false,
  131.         HeadsUpDisplay = true,
  132.         MaxSpeed = 25,
  133.         Steer = 0,
  134.         Throttle = 0,
  135.         Torque = 10,
  136.         TurnSpeed = 1,
  137.     },
  138.     ["WedgePart"] = {
  139.         BrickColor = BrickColor.new("Medium stone grey"),
  140.         Material = Enum.Material.Plastic,
  141.         Reflectance = 0,
  142.         Transparency = 0,
  143.         Name = "Part",
  144.         CFrame = CFrame.new(Vector3.new(0, 0, 0)),
  145.         RotVelocity = Vector3.new(0, 0, 0),
  146.         Velocity = Vector3.new(0, 0, 0),
  147.         Anchored = false,
  148.         Archivable = true,
  149.         CanCollide = true,
  150.         Locked = false,
  151.         Elasticity = 0.5,
  152.         FormFactor = Enum.FormFactor.Brick,
  153.         Friction = 0.30000001192093,
  154.         Size = Vector3.new(4, 1.2, 2),
  155.         BackParamA = -0.5,
  156.         BackParamB = 0.5,
  157.         BackSurfaceInput = Enum.InputType.NoInput,
  158.         BottomParamA = -0.5,
  159.         BottomParamB = 0.5,
  160.         BottomSurfaceInput = Enum.InputType.NoInput,
  161.         FrontParamA = -0.5,
  162.         FrontParamB = 0.5,
  163.         FrontSurfaceInput = Enum.InputType.NoInput,
  164.         LeftParamA = -0.5,
  165.         LeftParamB = 0.5,
  166.         LeftSurfaceInput = Enum.InputType.NoInput,
  167.         RightParamA = -0.5,
  168.         RightParamB = 0.5,
  169.         RightSurfaceInput = Enum.InputType.NoInput,
  170.         TopParamA = -0.5,
  171.         TopParamB = 0.5,
  172.         TopSurfaceInput = Enum.InputType.NoInput,
  173.         BackSurface = Enum.SurfaceType.Smooth,
  174.         BottomSurface = Enum.SurfaceType.Inlet,
  175.         FrontSurface = Enum.SurfaceType.Smooth,
  176.         LeftSurface = Enum.SurfaceType.Smooth,
  177.         RightSurface = Enum.SurfaceType.Smooth,
  178.         TopSurface = Enum.SurfaceType.Studs,
  179.     },
  180.     ["FileMesh"] = {
  181.         MeshId = "",
  182.         TextureId = "",
  183.         Offset = Vector3.new(0, 0, 0),
  184.         Scale = Vector3.new(1, 1, 1),
  185.         Archivable = true,
  186.         Name = "Mesh",
  187.         VertexColor = Vector3.new(1, 1, 1),
  188.     },
  189.     ["SpecialMesh"] = {
  190.         MeshType = Enum.MeshType.Head,
  191.         MeshId = "",
  192.         TextureId = "",
  193.         Offset = Vector3.new(0, 0, 0),
  194.         Scale = Vector3.new(1, 1, 1),
  195.         Archivable = true,
  196.         Name = "Mesh",
  197.         VertexColor = Vector3.new(1, 1, 1),
  198.     },
  199.     ["BlockMesh"] = {
  200.         Offset = Vector3.new(0,0,0),
  201.         Scale = Vector3.new(1, 1, 1),
  202.         Archivable = true,
  203.         Name = "Mesh",
  204.         VertexColor = Vector3.new(1, 1, 1),
  205.     },
  206.     ["CylinderMesh"] = {
  207.         Name = "Mesh",
  208.         Offset = Vector3.new(0, 0, 0),
  209.         Scale = Vector3.new(1, 1, 1),
  210.         VertexColor = Vector3.new(1, 1, 1),
  211.     },
  212.     ["Decal"] = {
  213.         Name = "Decal",
  214.         Shiny = 20,
  215.         Specular = 0,
  216.         Texture = "",
  217.         Transparency = 0,
  218.         Face = Enum.NormalId.Front,
  219.         Archivable = true,
  220.     },
  221.     ["Fire"] = {
  222.         Color = Color3.new(1, 127/255, 0),
  223.         Enabled = true,
  224.         Name = "Fire",
  225.         Heat = 9,
  226.         SecondaryColor = Color3.new(1,0,0),
  227.         Size=5,
  228.         Archivable = true,
  229.     },
  230.     ["Smoke"] = {
  231.         Color = Color3.new(1,1,1),
  232.         Enabled = true,
  233.         Name = "Smoke",
  234.         Opacity = 0.5,
  235.         RiseVelocity = 1,
  236.         Size = 1,
  237.     },
  238.     ["Sparkles"] = {
  239.         Enabled = true,
  240.         Name = "Sparkles",
  241.         SparkleColor = Color3.new(112/255, 231/255, 1/255),
  242.         Archivable = true,
  243.     },
  244.     ["Model"] = {
  245.         Name = "Model",
  246.         PrimaryPart = nil,
  247.         Archivable = true,
  248.     },
  249.     ["ClickDetector"] = {
  250.         Name = "ClickDetector",
  251.         MaxActivationDistance = 32,
  252.         Archivable = true,
  253.     },
  254.     ["BoolValue"] = {
  255.         Name = "BoolValue",
  256.         Archivable = true,
  257.     },
  258.     ["BrickColorValue"] = {
  259.         Name = "BoolValue",
  260.         Archivable = true,
  261.     },
  262.     ["Color3Value"] = {
  263.         Name = "BoolValue",
  264.         Archivable = true,
  265.     },
  266.     ["DoubleConstrainedValue"] = {
  267.         Name = "BoolValue",
  268.         Archivable = true,
  269.     },
  270.     ["IntConstrainedValue"] = {
  271.         Name = "BoolValue",
  272.         Archivable = true,
  273.     },
  274.     ["IntValue"] = {
  275.         Name = "BoolValue",
  276.         Archivable = true,
  277.     },
  278.     ["NumberValue"] = {
  279.         Name = "BoolValue",
  280.         Archivable = true,
  281.     },
  282.     ["ObjectValue"] = {
  283.         Name = "BoolValue",
  284.         Archivable = true,
  285.     },
  286.     ["RayValue"] = {
  287.         Name = "BoolValue",
  288.         Archivable = true,
  289.     },
  290.     ["StringValue"] = {
  291.         Name = "BoolValue",
  292.         Archivable = true,
  293.     },
  294.     ["Vector3Value"] = {
  295.         Name = "BoolValue",
  296.         Archivable = true,
  297.     },
  298.     ["CFrameValue"] = {
  299.         Name = "BoolValue",
  300.         Archivable = true,
  301.     },
  302.     ["BodyGyro"] = {
  303.         Name = "BodyGyro",
  304.         Archivable = true,
  305.         D = 500,
  306.         P = 3000,
  307.         maxTorque = Vector3.new(0,0,0),
  308.     },
  309.     ["BodyPosition"] = {
  310.         Name = "BodyPosition",
  311.         Archivable = true,
  312.         D = 1250,
  313.         P = 10000,
  314.         maxForce = Vector3.new(4000,4000,4000),
  315.         position = Vector3.new(0, 50, 0),
  316.     },
  317.     ["Texture"] = {
  318.         Shiny = 20,
  319.         Specular = 0,
  320.         StudsPerTileU = 2,
  321.         StudsPerTileV = 2,
  322.         Texture = "",
  323.         Transparency = 0,
  324.         Face = Enum.NormalId.Front,
  325.         Name = "Texture",
  326.         Archivable = true;
  327.     },
  328.     ["Weld"] = {
  329.         Name = "Weld",
  330.         Part0 = true,
  331.         Part1 = true,
  332.         Archivable = true,
  333.     },
  334.     ["Motor6D"] = {
  335.         Name = "Motor6D",
  336.         Part0 = true,
  337.         Part1 = true,
  338.         Archivable = true
  339.     },
  340.     ["Humanoid"] = {
  341.         Name = "Humanoid"
  342.     },
  343.     ["ManualWeld"] = {
  344.         Name = "Weld",
  345.         Part0 = true,
  346.         Part1 = true,
  347.         Archivable = true,
  348.     },
  349. }
  350.  
  351.  
  352.  
  353. function recurse(object, parent)
  354.     fulln = fulln + 1
  355.     if objects[object.ClassName] then
  356.         line = line + 1
  357.         if insert_waits then
  358.             wt = wt + 1
  359.             if wt == 20 then
  360.                 content = content.."wait()"..nlc..nlc
  361.                 wt = 0
  362.             end
  363.         end
  364.         parsed[object.ClassName] = (parsed[object.ClassName] and parsed[object.ClassName] + 1 or 1)
  365.         content = content.."-- "..line.." - "..object.Name.."\n"
  366.         local var = "obj"..line
  367.         content = content..var.." = Instance.new(\""..object.ClassName.."\")"..nlc
  368.         for i, v in pairs(objects[object.ClassName]) do
  369.             if object[i] ~= v then
  370.                 cusv = object[i]
  371.                 if type(cusv) == "boolean" then
  372.                     cusv = tostring(cusv)
  373.                 elseif type(cusv) == "userdata" then
  374.                     if i == "BrickColor" then
  375.                         cusv = "BrickColor.new(\""..tostring(cusv).."\")"
  376.                     elseif i=="Size" or i=="RotVelocity" or i=="Velocity" or i=="Scale" or i=="Offset" or i=="VertexColor" or i=="maxForce" or i=="position" or i=="maxTorque" then
  377.                         cusv = "Vector3.new("..tostring(cusv)..")"
  378.                     elseif i=="CFrame" then
  379.                         local cx, cy, cz = object.CFrame:toEulerAnglesXYZ()
  380.                         cusv = "CFrame.new(Vector3.new("..tostring(object.Position)..")) * CFrame.Angles("..cx..", "..cy..", "..cz..")"
  381.                     elseif i=="Color" or i=="SecondaryColor" or i=="SparkleColor" then
  382.                         cusv = "Color3.new("..tostring(cusv)..")"
  383.                     end
  384.                 elseif type(cusv) == "string" then
  385.                     cusv = "\""..cusv:gsub("\"", "\\\"").."\""
  386.                 end
  387.                 content = content..var.."."..i.." = "..tostring(cusv)..nlc
  388.             end
  389.         end
  390.         content = content..var..".Parent = "..parent..nlc..nlc
  391.         for i, v in pairs(object:children()) do
  392.             recurse(v, var)
  393.         end
  394.     else
  395.         skipped[object.ClassName] = (skipped[object.ClassName] and skipped[object.ClassName] + 1 or 1)
  396.         skippedn = skippedn+1
  397.     end
  398. end
  399.  
  400. function M2S(model)
  401.     content = ""
  402.     line = 0
  403.     fulln = 0
  404.     parsed = {}
  405.     skipped = {}
  406.     skippedn = 0
  407.     wt = 0
  408.     nlc = "\n"
  409.     wait()
  410.     recurse(model, "Workspace")
  411.     ski = ""
  412.     for i, v in pairs(skipped) do
  413.         ski=ski..i..": "..v.."\n        "
  414.     end
  415.     par = ""
  416.     for i, v in pairs(parsed) do
  417.         par=par..i..": "..v.."\n        "
  418.     end
  419.     content = "--[[\
  420.     -- M2S by Coolbob44 --\
  421.     Current Version: ".."1".."\
  422.     \
  423.     Model: "..model.Name.."\
  424.     You can use this script to generate your model!\
  425.     \
  426.     Objects Parsed: "..line.."\
  427.         "..par.."\
  428.     Objects Skipped: "..skippedn.."\
  429.         "..ski.."\
  430.     Total: "..fulln.."\
  431.     \
  432. --]]\
  433.     \n\n"..content
  434.    
  435.     content = content..nlc.."obj1:MakeJoints()\n"
  436.     print(content)
  437.     local s = Instance.new("Script")
  438.     s.Name = "Model to Script"
  439.     s.Source = content
  440.     s.Parent = Workspace
  441. end
  442. M2S(Workspace.Model);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement