So I’m trying to make a character customization where you can load HAIR items from the catalog using this:
InsertService:LoadAsset(ID)
And then I was gonna check the Enum.AccessoryType of the Accessory so you can only add HAIRS but no matter, what the accessory type is always ‘Unknown’. Is there anyway to check this?
but your best bet would be to have a predefined list of hairs or use the roblox API to get a list of hairs from the catalog that the player can choose from. (or, be a sane person and use an already made catalog browser)
TextBox.FocusLost:Connect(function(enterPressed)
if enterPressed then
remote:FireServer(tonumber(TextBox.Text), character)
end
end)
Server Script:
remote.OnServerEvent:Connect(function(player, id, character)
local success, err = pcall(function()
local new = InsertService:LoadAsset(id)
local accessory = new:FindFirstChildOfClass("Accessory")
local handle = accessory:FindFirstChild("Handle")
local mesh
game.Debris:AddItem(new, 10)
for _, v in pairs(accessory:GetDescendants()) do
if v:IsA("SpecialMesh") then
mesh = v
end
end
if mesh then
mesh.TextureId = ""
accessory.Parent = character
end
end)
end)
The script works well but I need a way to only allow hair accessories to be loaded