Advertisement
advancedev

time

Jan 19th, 2015
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.76 KB | None | 0 0
  1. scale = 1 / 11
  2.  
  3. local representation = Instance.new("Model")
  4. representation.Parent = script.Parent
  5. representation.archivable = false
  6. representation.Name = "Minimap"
  7.  
  8. function makeRepresentation(obj, cf, name)
  9. if not obj.archivable then
  10. return
  11. end
  12. if ((obj.className == "Part") or (obj.className == "Seat") or (obj.className == "SpawnLocation") or (obj.className == "WedgePart")) then
  13. local rep = Instance.new("Part")
  14. rep.formFactor = obj.formFactor
  15. rep.Size = obj.Size * scale
  16. rep.Transparency = obj.Transparency
  17. rep.Reflectance = obj.Reflectance
  18. rep.BrickColor = obj.brickColor
  19. rep.Anchored = true
  20. rep.Locked = true
  21. rep.TopSurface = Enum.SurfaceType.Smooth
  22. rep.BottomSurface = Enum.SurfaceType.Smooth
  23. if obj.className ~= "WedgePart" then
  24. rep.Shape = obj.Shape
  25. end
  26. rep.Name = name
  27. mesh = Instance.new("SpecialMesh")
  28. mesh.Scale = obj.Size * scale / rep.Size
  29. local list = obj:GetChildren()
  30. local objMesh = nil
  31. for x = 1, #list do
  32. if (list[x].className == "Decal") then
  33. local copy = list[x]:Clone()
  34. copy.Parent = rep
  35. elseif (list[x].className == "SpecialMesh") or (list[x].className == "CylinderMesh") or (list[x].className == "BlockMesh") then
  36. objMesh = list[x]
  37. end
  38. end
  39. if objMesh ~= nil and obj.className ~= "WedgePart" then
  40. mesh:Remove()
  41. mesh = objMesh:Clone()
  42. if (objMesh.className == "SpecialMesh") and (objMesh.MeshType == Enum.MeshType.FileMesh) then
  43. mesh.Scale = objMesh.Scale * scale
  44. else
  45. mesh.Scale = objMesh.Scale * obj.Size * scale / rep.Size
  46. end
  47. elseif obj.className ~= "WedgePart" and obj.Shape == Enum.PartType.Ball then
  48. mesh.MeshType = Enum.MeshType.Sphere
  49. elseif obj.className ~= "WedgePart" and obj.Shape == Enum.PartType.Block then
  50. mesh:Remove()
  51. mesh = Instance.new("BlockMesh")
  52. mesh.Scale = obj.Size * scale / rep.Size
  53. --mesh.MeshType = Enum.MeshType.Brick
  54. elseif obj.className == "WedgePart" then
  55. mesh.MeshType = "Wedge"
  56. mesh.Parent = rep
  57. mesh.Scale = obj.Size * scale / rep.Size
  58. else
  59. mesh.MeshType = Enum.MeshType.Cylinder
  60. rep.Shape = Enum.PartType.Ball
  61. end
  62. mesh.Parent = rep
  63. rep.CFrame = cf:toWorldSpace(obj.CFrame + obj.Position * (scale - 1))
  64. rep.Parent = representation
  65. else
  66. if (obj == workspace) or (((obj.className == "Model") or (obj.className == "Tool") or (obj.className == "Hat")) and (obj ~= representation)) then
  67. local list = obj:GetChildren()
  68. for x = 1, #list do
  69. wait()
  70. makeRepresentation(list[x], cf, name .. "->" .. list[x].Name)
  71. end
  72. end
  73. end
  74. end
  75.  
  76. local _, t = wait()
  77. print("Making a mini-map...")
  78. makeRepresentation(workspace, CFrame.new(0, 50, 0), "Workspace")
  79. local _2, t2 = wait()
  80. print("Mini-map is done! Time taken: " .. t2 - t .. " seconds.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement