(R6) SpecialMesh accessory to MeshPart

I want to insert accessories as meshparts in my R6 roleplay game to allow players to customise the accessories nicely with material capabilities. I’ve seen this ‘workaround’ in the solution of another post: R6 SpecialMesh Accessory to MeshPart, but this no longer seems to work. I think it’s because Roblox removed the workspace property that controlled how accessories are inserted after they rolled out meshpart accessories as the new R15 default.

I tried inserting accessories in a new baseplate with the avatar settings set to R15 only, and inserting accessories in Studio loads them as meshparts. The same happens when the avatar settings are set to R15 & R6, but changing the settings to R6 makes them load as parts + special meshes even when inserting the accessory into an R15 rig like the aforementioned workaround suggested.

Is there any way to get around this?

1 Like

Mmm! I have been wanting to figure this out to, I will research for you on a way to do this.

[Edit 1] I did find a plugin that can convert meshes to a mesh part, but I am unsure about a way to do this in a script.
Here is the plugin I found: Kipukii’s Mesh Converter

1 Like

I looked at the code of the plugin @ihavenomoneyshelpme sent:

I copied some of that code over and I’ve added a Convert() function that copies over the handle’s children.

local InsertService = game:GetService('InsertService')

local properties = { 
	"Anchored", "AssemblyAngularVelocity", "AssemblyLinearVelocity", "BackSurface", "BottomSurface", "BrickColor", "CFrame", "CanCollide","CanQuery", "Transparency",
	"CanTouch", "CastShadow", "CollisionGroup", "Color", "CustomPhysicalProperties", "EnableFluidForces", "FrontSurface", "LeftSurface", "TopSurface", "Name",
	"LocalTransparencyModifier", "Locked", "Massless", "Material", "MaterialVariant", "PivotOffset", "Reflectance", "RightSurface",  "RootPriority", "Size" 
}

local function ToMeshpart( part : BasePart ) : MeshPart
	local mesh = part:FindFirstChildWhichIsA('SpecialMesh')
	if not mesh then return nil end

	local new = InsertService:CreateMeshPartAsync( mesh.MeshId, Enum.CollisionFidelity.Hull, Enum.RenderFidelity.Automatic )
	
	for _, property in properties do
		new[property] = part[property]
	end

	new.TextureID = mesh.TextureId
	new.Size = mesh.Scale * new.MeshSize
	
	mesh:Destroy()
	return new
end

local function Convert( accessory : Accoutrement ) 
	local handle = accessory:FindFirstChild('Handle') :: BasePart
	if not handle or handle:IsA('MeshPart') then return end

	local mesh = ToMeshpart( handle )
	if not mesh then return end

	for _, child in handle:GetChildren() do
		if child:IsA('TouchTransmitter') then continue end
		child.Parent = mesh
	end
	handle:Destroy()

	mesh.Parent = accessory
end

local fedora = workspace.Rig.Fedora
Convert( fedora )

It creates a MeshPart using InsertService, copies over the SpecialMesh’s properites, then calculates it’s size and assigns the TextureID.

Then, it deletes the SpecialMesh, moves the Handle’s children to our MeshPart, and now our accessory is converted.

You are unable to assign a parent to TouchTransmitters (or TouchInterests), but we can safely ignore them because one will be automatically created.

Hope this helps!

2 Likes

Thank you so much @ihavenomoneyshelpme and @Darstrial , this works!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.