I don’t think there is a feature as such, but it would be great if it existed so I wouldn’t have to create a complete equipment system specifying how to add each item, I don’t know if that’s the best way.
local InsertService = game:GetService("InsertService")
local function giveAccessory(humanoid: Humanoid, assetId: number)
local Accessory = InsertService:LoadAsset(assetId):GetChildren()[1]
humanoid:AddAccessory(Accessory)
end
giveAccessory(...)
I currently use that method to load and equip accessories, but it only adds the accessories to the character and doesn’t put them in the HumanoidDescription. So I’m looking for something that actually equips those accessories by their id in the humanoid so I can load it later easily with :ApplyDescription() (All these items are from the catalog) And so that the player can later edit the order of his layered clothing
--[[ Server Script ]]--
local Players = game:GetService("Players")
local MarketPlaceSerivce = game:GetService("MarketplaceService")
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local humanoid: Humanoid = character.Humanoid
---
local ACCESSORY_INDEX = {
[8] = "HatAccessory",
[41] = "HairAccessory",
[42] = "FaceAccessory",
[43] = "NeckAccessory",
[44] = "ShouldersAccessory",
[45] = "FrontAccessory",
[46] = "BackAccessory",
[47] = "WaistAccessory",
}
local function addAccessory(description: HumanoidDescription, accessoryId: number)
local info = MarketPlaceSerivce:GetProductInfo(accessoryId)
if not info then warn("Accessory ID is not valid") return end
local AccessoryType = ACCESSORY_INDEX[info.AssetTypeId]
if description[AccessoryType] == "" then
description[AccessoryType] = "" .. accessoryId
else
description[AccessoryType] ..= ",".. accessoryId
end
end
---
local HumanoidDescription = humanoid:GetAppliedDescription()
addAccessory(HumanoidDescription, 9305847750)
humanoid:ApplyDescriptionReset(HumanoidDescription)
local descriptionWithAccessories = humanoid:GetAppliedDescription()
-- Do something with this
end)
end)
Thank you! I forgot to say that parameters like id, itemType and assetType are not a problem to get in the script, I’m just looking for a good method to equip any asset in HumanoidDescription, but I think it should be specified if it is a t-shirt, a bodypart and everything when Roblox could add something that does this automatically. Well, I appreciate your help and I’ll post again when I resolve the issue!