Hello Creators,
To enable upcoming avatar features, we are rolling out an upgraded HumanoidDescription API. This new API adds new AccessoryDescription
and BodyPartDescription
sub-instances, which are used as children of a HumanoidDescription
.
This change is fully backward compatible with the old HumanoidDescription APIs: changing a property on the HumanoidDescription will modify the relevant AccessoryDescription or BodyPartDescription, and adding, removing, or modifying one of the sub-instances will also modify the HumanoidDescription properties.
Rollout Plan
Due to the complicated backward compatibility requirements, the rollout of this feature will be slightly unusual. We have already rolled it out for RCC and will enable it for clients in the coming days. We won’t be turning this on for Studio until after this has been rolled out to clients and we know we don’t need to turn it off, to avoid needing to remove AccessoryDescriptions and BodyPartDescriptions and move storing the details back into the HumanoidDescription. We will let you know when this has been fully rolled out and it is safe for you to start adding AccessoryDescriptions and BodyPartDescriptions in Studio and start using these in your scripts. Until then, keep using the old API as you have been doing!
Instance support
One big advantage of this change is the HumanoidDescription API now supports using instances for BodyParts and Accessories alongside AssetIds. This means that you can use the HumanoidDescription API to apply an Accessory that only exists in your experience to an avatar without it needing to be uploaded as an asset on the platform. This is supported through the AccessoryDescription.Instance
and BodyPartDescription.Instance
properties.
Here is an example of how an Instance-based accessory can be applied to an Avatar:
local humanoidDescription : HumanoidDescription = player.Character.Humanoid:GetAppliedDescription()
local accessoryDescription = Instance.new("AccessoryDescription")
accessoryDescription.Instance = game.ReplicatedStorage.HairAccessory
accessoryDescription.IsLayered = false
accessoryDescription.AccessoryType = Enum.AccessoryType.Hair
accessoryDescription.Parent = humanoidDescription
player.Character.Humanoid:ApplyDescription(humanoidDescription)
New Accessory Adjustment Properties
You may notice several new properties on the new AccessoryDescription instance that aren’t supported in the previous API. These Position, Rotation, and Scale properties are not yet enabled but will be very soon. Be on the lookout for an Accessory Adjustment announcement in the coming weeks!
Humanoid.ApplyDescriptionFinished
As part of this upgrade, we have also added a new ApplyDescriptionFinished event to Humanoid. Previously if applying a description on the server, on the client it would be possible to listen to ChildAdded on the Humanoid for the new HumanoidDescription and it would be immediately up to date. This may no longer be true now that the information is split across HumanoidDescription and child instances that may not be parented to the HumanoidDesription at the time this is fired on the client. The ApplyDescriptionFinished event will give the guarantee that the HumanoidDescription is ready to be used and all the sub-instance children exist.
[Edit] Duplicate BodyPart or Asset bug
During the rollout of this change, there was a circumstance when publishing from a team create game to another place caused duplicate AccessoryDescriptions or BodyPartDescriptions to be created. If your game is experiencing this problem, see this post for how to fix it:
For full details on the API, check out the documentation pages for AccessoryDescription and BodyPartDescription.
If you notice any bugs that might be caused by this change or have any feedback for future improvements to the HumanoidDescription API or avatar APIs in general, please let us know!