Advertisement
QuantumWarpCode

Part Functions for Roblox V2

Jul 19th, 2014
440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function createPart(name1,x1,y1,z1,parent1,xs,ys,zs,type)
  2.     --Sets the properties of part.
  3.     part = Instance.new(type,parent1)
  4.     part.Name = name
  5.     part.FormFactor = "Custom"
  6.     part.Size = Vector3.new(xs,ys,zs)
  7.     part.Position = Vector3.new(x1,y1,z1)
  8.     part.Anchored = true
  9.     part.BottomSurface = 10
  10.     part.TopSurface = 10
  11.     part.RightSurface = 10
  12.     part.LeftSurface = 10
  13.     part.FrontSurface = 10
  14.     part.BackSurface = 10
  15. end
  16.  
  17. function adjustParts(x2,y2,z2,parent2)
  18.     --Gets the children.
  19.     local c = model2:GetChildren()
  20.     for index, child in pairs(c) do
  21.         --Adjusts by addition.
  22.         child.Position = child.Position + Vector3.new(x2,y2,z2)
  23.     end
  24. end
  25.  
  26. function combineModelsN(name,base)
  27.     local c = base:GetChildren()
  28.     NewModel = Instance.new("Model",game.Workspace)
  29.     for index, child in pairs(c) do
  30.         if child.className == "Model" then
  31.             local d = child:GetChildren()
  32.             for index, children in pairs(d) do
  33.                 children.Parent = NewModel
  34.             end
  35.             child:remove()
  36.         end
  37.     end
  38. end
  39.  
  40. function combineModelsT(m1,m2,loc)
  41.     NewModel = Instance.new("Model",loc)
  42.     local c = m1:GetChildren()
  43.     for index, children in pairs(c) do
  44.         children.Parent = NewModel
  45.     end
  46.     m1:remove()
  47.     local c = m2:GetChildren()
  48.     for index, children in pairs(c) do
  49.         children.Parent = NewModel
  50.     end
  51.     m2:remove()
  52. end
  53.  
  54. function setColorM(model,color)
  55.     local c = model:GetChildren()
  56.     for index, child in pairs(c) do
  57.         child.BrickColor = color
  58.     end
  59. end
  60.  
  61. _G.createPart = createPart
  62. _G.adjustParts = adjustParts
  63. _G.combineModelsN = combineModelsN
  64. _G.combineModelsT = combineModelsT
  65. _G.setColorM = setColorM
  66.  
  67. _G.FunctionsStored = true --Make scripts wait for this to use functions
  68.  
  69. script:Destroy()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement