Using Humanoid:ApplyDescription()
and Humanoid:ApplyDescriptionReset()
you can successfully load any AvatarAsset on the client with one exception: UGC-Layered-Clothing. I do not know why this is the case, the above post explains how I discovered this. This seems to be a massive oversight.
Case in point: Run this code twice, once in a script with RunContext Server and one with RunContext Client. I discovered this was the case of the given AssetId but it applies to others as well. Is this a misunderstanding on my part or is this an internal error with Humanoids?
local function MakeLoaderHumanoid()
local LoaderModel = Instance.new("Model") -- Load accessory for a "fake" R15 rig
local LoaderHumanoid = Instance.new("Humanoid")
LoaderHumanoid.RigType = Enum.HumanoidRigType.R15
LoaderHumanoid.Parent = LoaderModel
local LoaderRoot = Instance.new("Part")
LoaderRoot.Name = "HumanoidRootPart"
LoaderRoot.Size = Vector3.new(2,2,1)
LoaderRoot.Anchored = true
LoaderRoot.Parent = LoaderModel
LoaderModel.Parent = game:GetService("ServerStorage")
LoaderHumanoid:ClearAllChildren()
return LoaderHumanoid,LoaderModel
end
local function LoadAsset(HumanoidDescription,ClassName)-- Loads this HumanoidDescription and gets the first asset that matches ClassName
local LoaderHumanoid,LoaderModel = MakeLoaderHumanoid()
local AddedAssets = {}
LoaderModel.Parent = workspace
HumanoidDescription.Parent = LoaderHumanoid
LoaderHumanoid:ApplyDescriptionReset(HumanoidDescription)
end
local function LoadAccessory(AssetId,AccessoryType) -- Returns a created asset by doing methods to make them on client
local LoaderDescription = Instance.new("HumanoidDescription")
LoaderDescription.WaistAccessory = AssetId
return LoadAsset(LoaderDescription,"Accessory")
end
task.wait(2)
LoadAccessory(18937787242,Enum.AvatarAssetType.Pants)
If you have ran the above, you will notice in one of the loaderrigs there will be an Accessory whilst the other (Runcontext = Client) will not have it.
This is extremely frustrating. Keep in mind this is ONLY the case for UGC Layered Clothing. It does NOT apply to Roblox owned layered clothing, Roblox owned accessories or non layered UGC Accessories. For example, running the code above with a Roblox owned LayeredClothing, or any non-layered accessory both rigs will have properly loaded the asset.
Expected behavior
The expected behavior is for the Accessories to load properly. I do not believe that Humanoid:ApplyDescription
and Humanoid:ApplyDescriptionReset
should be locked to the server as this slightly complicates ViewportFrame rendering and limits developer creativity.
I opted to include this in Asset Imports due to this pretaining to the way AvatarAssets are imported using Humanoid:ApplyDescription
and Humanoid:ApplyDescriptionReset
A private message is associated with this bug report