How would you go about converting all mesh parts in a game's workspace into regular parts?

Hey,

I have an idea on how to approach this, but wanted to see what others think would work best. How would I go about doing this? Keep in mind, it would be done in edit mode of studio, so that the changes could then be published. My game has way too many mesh parts that can be replaced with regular, so what’s the best way to do this?

1 Like

The only good way to do this without any negative repercussions would be to just manually replace all the mesh parts to where you see fit. Arguably, you could run a script to get all possible meshes and replace them with parts of similar size, colour, position, etc however this would lead to wrong meshes being translated as well.

1 Like

In the command line, run this code I wrote, bear in mind that this will destroy every mesh part after it’s done making a part that replaces it. If you don’t want that to happen, remove the v:Destroy() line.

for _, v : MeshPart in next, workspace:GetDescendants() do
	if v:IsA("MeshPart") then
		local part = Instance.new("Part");
		part.BrickColor = v.BrickColor;
		part.Material = v.Material;
		part.Reflectance = v.Reflectance;
		part.Transparency = v.Transparency;
		
		part.Archivable = v.Archivable;
		part.Locked = v.Locked;
		part.Name = v.Name;
		part.Parent = v.Parent;
		
		part.Size = v.Size;
		part.Position = v.Position;
		part.Orientation = v.Orientation;
		
		part.CanCollide = v.CanCollide;
		part.CanTouch = v.CanTouch;
		part.CollisionGroupId = v.CollisionGroupId;
		part.CanQuery = v.CanQuery;
		
		part.Anchored = v.Anchored;
		part.CustomPhysicalProperties = v.CustomPhysicalProperties;
		part.Massless = v.Massless;
		part.RootPriority = v.RootPriority;
		
		v:Destroy();
	end	
end
1 Like

I was just going to do a i,v pairs sequence, but didn’t know what properties to supply. Thanks! Will be sure to try this out.

1 Like