How do I add hair to a r6 dummy?

Hello, I am currently trying to make a system that randomizes the appearance of a dummy in my game.

Its doing this by having multiple tables full of assetId’s:

local possibleHairs = {}
local possibleFace = {}
local possibleSkin = {}
local possibleFirstNames = {}
local possibleLastNames = {}

then when I want to get a random item I just do

["Hair"] = possibleHairs[math.random(1, #possibleHairs)] ,
					["Face"] = possibleFace[math.random(1, #possibleFace)],
					["Skin"] = possibleSkin[math.random(1, #possibleSkin)],
					["Name"] = possibleFirstNames[math.random(1, #possibleFirstNames)] .. " " .. possibleLastNames[math.random(1, #possibleLastNames)],

these systems work well but I noticed that I cant just change the assetId on hats. you have to get it from toolbox.

As you can see here, this is the hat I got from toolbox:


but when I change it to the assetId from the roblox catalog on a hair:

image

then copy and paste it into the toolbox hair:

image

they appear bald:

image

Catalog and MeshPart/SpecialMesh asset IDs are not the same. Catalog IDs only point to the product, while Mesh IDs point to the accessory/hair/hat’s geometry.

You have to somehow insert the accessory using a Catalog ID, find the Accessory part, and place it on your model.

Programmatically, you must use InsertService:LoadAsset(CatalogID), find the first accoutrement (FindFirstChildWhichIsA("Accoutrement") for both Accessory and Hat items), store that accessory for later instead of loading it again, clone it, and parent the copy to your model.

I am pretty sure you can store it in a variable so like:

 local hat = game:GetService("InsertService"):LoadAsset(CatalogID)
hat.Parent = workspace.Dummy

shall indeedly work

here is a code I made (for future people) which ended up working. Thanks for the idea of using insertservice!!!

--// process the hat
local hat = game:GetService("InsertService"):LoadAsset(7259123616)

--// extract valuable information
for i,v in pairs(hat:GetChildren()) do 
v.Parent = workspace.Dummy
end 

--// remove excess waste
hat:Destroy()

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