Function to Convert Library of SpecialMesh to MeshParts

This is a useful function to run in the command line or during runtime to convert a directory of Special Meshes to MeshParts using the newer InsertService | Documentation - Roblox Creator Hub method.

Some extra steps I did was to scale the meshpart to the size and cframe of your handle based on the default scale of the meshpart * the scale and offset the cframe by the offset to achieve the exact size and cframe of the original special mesh.

local Accessories=workspace.Accessories
local RenderFidelity=Enum.RenderFidelity.Precise
local CollisionFidelity=Enum.CollisionFidelity.Default
for i,v in Accessories:GetChildren() do local h=v:FindFirstChild("Handle") if h then local c=h:FindFirstChildOfClass("SpecialMesh") if c then
 local i=game.InsertService:CreateMeshPartAsync(c.MeshId,CollisionFidelity,RenderFidelity)
 i.TextureID=c.TextureId i.Size*=c.Scale
 i.CFrame=h.CFrame:ToWorldSpace(CFrame.new(c.Offset))
 i.Name=v.Name
 i.Parent=v 
end
end
end

What are the advantages of using meshparts over special meshes? You can use precise collision, surface appearances with alpha channels and color the texture, and you can use the AI texture generator to create new textures!

4 Likes