Advertisement
SmokeDelsin

mini me maker

May 25th, 2015
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.44 KB | None | 0 0
  1. scale = 1 / 4
  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")) 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. rep.Shape = obj.Shape
  24. rep.Name = name
  25. mesh = Instance.new("SpecialMesh")
  26. mesh.Scale = obj.Size * scale / rep.Size
  27. local list = obj:GetChildren()
  28. local objMesh = nil
  29. for x = 1, #list do
  30. if (list[x].className == "Decal") then
  31. local copy = list[x]:Clone()
  32. copy.Parent = rep
  33. elseif (list[x].className == "SpecialMesh") or (list[x].className == "CylinderMesh") or (list[x].className == "BlockMesh") then
  34. objMesh = list[x]
  35. end
  36. end
  37. if objMesh ~= nil then
  38. mesh:Remove()
  39. mesh = objMesh:Clone()
  40. if (objMesh.className == "SpecialMesh") and (objMesh.MeshType == Enum.MeshType.FileMesh) then
  41. mesh.Scale = objMesh.Scale * scale
  42. else
  43. mesh.Scale = objMesh.Scale * obj.Size * scale / rep.Size
  44. end
  45. elseif obj.Shape == Enum.PartType.Ball then
  46. mesh.MeshType = Enum.MeshType.Sphere
  47. elseif obj.Shape == Enum.PartType.Block then
  48. mesh:Remove()
  49. mesh = Instance.new("BlockMesh")
  50. mesh.Scale = obj.Size * scale / rep.Size
  51. --mesh.MeshType = Enum.MeshType.Brick
  52. else
  53. mesh.MeshType = Enum.MeshType.Cylinder
  54. rep.Shape = Enum.PartType.Ball
  55. end
  56. mesh.Parent = rep
  57. rep.CFrame = cf:toWorldSpace(obj.CFrame + obj.Position * (scale - 1))
  58. rep.Parent = representation
  59. else
  60. if (obj == workspace) or (((obj.className == "Model") or (obj.className == "Tool") or (obj.className == "Hat")) and (obj ~= representation)) then
  61. local list = obj:GetChildren()
  62. for x = 1, #list do
  63. wait()
  64. makeRepresentation(list[x], cf, name .. "->" .. list[x].Name)
  65. end
  66. end
  67. end
  68. end
  69.  
  70. local _, t = wait()
  71. print("Making a mini-map...")
  72. makeRepresentation(workspace, CFrame.new(0, 1.2, 0), "Workspace")
  73. local _2, t2 = wait()
  74. print("Mini-map is done! Time taken: " .. t2 - t .. " seconds.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement