
Special

Warning Level:
Number of posts: 2664
Age: 9
Location: • Your Conscience •
Registration date: 2008-07-07
How do I make a model a mesh.. It's a script that shrinks anything that is named Model, and meshes with classes Special Mesh, Cylinder Mesh, and Block Mesh.
- Code:
scale = 1 / 10
local representation = Instance.new("Model")
representation.Parent = script.Parent
representation.archivable = false
representation.Name = "SmallMap"
function makeRepresentation(obj, cf, name)
if not obj.archivable then
return
end
if ((obj.className == "Part") or (obj.className == "Seat") or (obj.className == "SpawnLocation")) then
local rep = Instance.new("Part")
rep.formFactor = obj.formFactor
rep.Size = obj.Size * scale
rep.Transparency = obj.Transparency
rep.Reflectance = obj.Reflectance
rep.BrickColor = obj.brickColor
rep.Anchored = true
rep.Locked = true
rep.TopSurface = Enum.SurfaceType.Smooth
rep.BottomSurface = Enum.SurfaceType.Smooth
rep.Shape = obj.Shape
rep.Name = name
mesh = Instance.new("SpecialMesh")
mesh.Scale = obj.Size * scale / rep.Size
local list = obj:GetChildren()
local objMesh = nil
for x = 1, #list do
if (list[x].className == "Decal") then
local copy = list[x]:Clone()
copy.Parent = rep
elseif (list[x].className == "SpecialMesh") or (list[x].className == "CylinderMesh") or (list[x].className == "BlockMesh") then
objMesh = list[x]
end
end
if objMesh ~= nil then
mesh:Remove()
mesh = objMesh:Clone()
if (objMesh.className == "SpecialMesh") and (objMesh.MeshType == Enum.MeshType.FileMesh) then
mesh.Scale = objMesh.Scale * scale
else
mesh.Scale = objMesh.Scale * obj.Size * scale / rep.Size
end
elseif obj.Shape == Enum.PartType.Ball then
mesh.MeshType = Enum.MeshType.Sphere
elseif obj.Shape == Enum.PartType.Block then
mesh:Remove()
mesh = Instance.new("BlockMesh")
mesh.Scale = obj.Size * scale / rep.Size
--mesh.MeshType = Enum.MeshType.Brick
else
mesh.MeshType = Enum.MeshType.Cylinder
rep.Shape = Enum.PartType.Ball
end
mesh.Parent = rep
rep.CFrame = cf:toWorldSpace(obj.CFrame + obj.Position * (scale - 1))
rep.Parent = representation
else
if (obj == workspace) or (((obj.className == "Model") or (obj.className == "Tool") or (obj.className == "Hat")) and (obj ~= representation)) then
local list = obj:GetChildren()
for x = 1, #list do
wait()
makeRepresentation(list[x], cf, name .. "->" .. list[x].Name)
end
end
end
end
local _, t = wait()
print("Making a Small-Map...")
makeRepresentation(workspace, CFrame.new(0, 1.2, 0), "Workspace")
local _2, t2 = wait()
print("Small-Map is done! Time taken: " .. t2 - t .. " seconds.")
It's a really good MiniMap maker, but it doesn't minimap wedges, which makes my weapon look lame.
____________________________
Evening, Guest Welcome to the Roblox Today Forums!
Hello, I am Alex. The Forum's Head Moderator.
I joined ROBLOX, December 29th, 2007!
I was one of the first to join this lovely forum, invited by Clayton himself. The memories. Ah.
Administrators have too much power, therefore my position suits me just fine!