Advertisement
KrYn0MoRe

dimension structure multiply

Dec 8th, 2020
899
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.74 KB | None | 0 0
  1. function rod(p1,p2,color)
  2.     local att1,att2 = Instance.new("Attachment"),Instance.new("Attachment")
  3.     att1.Parent = p1
  4.     att2.Parent = p2
  5.     local bar = Instance.new("RodConstraint")
  6.     bar.Visible = true
  7.     bar.Thickness = 0.05
  8.     bar.Attachment0 = att1
  9.     bar.Attachment1 = att2
  10.     bar.Color = BrickColor.new(color)
  11.     bar.Parent = p1
  12. end
  13.  
  14. function make_part(pos)
  15.     local p = Instance.new("FlagStand")
  16.     p.Size = Vector3.new()
  17.     p.Position = pos
  18.     p.Anchored = true
  19.     p.CanCollide = false
  20.     p.Massless = true
  21.     p.Locked = true
  22.     p.CastShadow = false
  23.     p.Parent = script
  24.     return p
  25. end
  26.  
  27. function check(p,t)
  28.     for i,v in pairs(p:GetChildren()) do
  29.         if v:IsA("RodConstraint") then
  30.             if not v.Attachment0:IsDescendantOf(t) and not v.Attachment1:IsDescendantOf(t) then else
  31.                 return true
  32.             end
  33.         end
  34.     end
  35.     return false
  36. end
  37.  
  38. function dimension_multiply(n,s)
  39.     local t = {}
  40.     local x,y,z = s.X,s.Y,s.Z
  41.     table.insert(t,1,make_part(Vector3.new(x,0,0)))
  42.     table.insert(t,1,make_part(Vector3.new(0,y,0)))
  43.     table.insert(t,1,make_part(Vector3.new(x,y,0)))
  44.     table.insert(t,1,make_part(Vector3.new(0,0,z)))
  45.     table.insert(t,1,make_part(Vector3.new(0,y,z)))
  46.     table.insert(t,1,make_part(Vector3.new(x,y,z)))
  47.     table.insert(t,1,make_part(Vector3.new(x,0,z)))
  48.     table.insert(t,1,make_part(Vector3.new(0,0,0)))
  49.     for _ = 1,n-1 do
  50.         local ot = {table.unpack(t)}
  51.         for i,v in pairs(ot) do
  52.             table.insert(t,1,make_part(v.Position*2))
  53.         end
  54.     end
  55.     for _,p in pairs(t) do
  56.         for i,v in pairs(t) do
  57.             local bar = v:FindFirstChildOfClass("RodConstraint")
  58.             if v ~= p --[[and ((not check(p,v) and not check(v,p)) or bar)]] then
  59.                 local color = Color3.new(i/#t,0,0)
  60.                 v.Color = color
  61.                 rod(p,v,color)
  62.             end
  63.         end
  64.     end
  65. end
  66.  
  67. dimension_multiply(3,Vector3.new(10,10,5))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement