Hi Creators,
We’re excited to announce the launch of the Accessory Adjustment Tool APIs for Neck, Shoulder, Front, and Back Accessories. Last year, we introduced the Accessory Adjustment tool for Head and Face Accessories in the Avatar Editor and with APIs for adjustment within your experiences.
Today, we’re expanding to include Front, Back, Neck, and Shoulder accessories. Using the upgraded HumanoidDescription API, you can allow users to adjust the position, rotation, and scale of those accessories on their avatars – whether they own the items or are previewing them before purchasing. This opens up a whole new level of compatibility between avatars and their accessories.
When users own adjusted accessories, these changes can be saved to the platform via AvatarEditorService:PromptSaveAvatar. You can also pair this with PromptCreateOutfit
to let users save their full Avatar, including adjustments, under Characters > Saved.
Here’s an example server script and local script you can try out yourself:
Server Script:
-- Accessory Adjustment server script
local Players = game:GetService("Players")
local userId = -1 -- replace with your userId
local playerModel = Players:CreateHumanoidModelFromUserId(userId)
playerModel.Parent = workspace
local humanoid = playerModel.Humanoid
local newHD = game.Players:GetHumanoidDescriptionFromUserId(userId)
local accessoryDescription = Instance.new("AccessoryDescription")
accessoryDescription.AssetId = 98752422639730 -- add a Back Accessory that you own
accessoryDescription.AccessoryType = Enum.AccessoryType.Back
accessoryDescription.Parent = newHD
playerModel.Humanoid:ApplyDescription(newHD)
for i, description in humanoid.HumanoidDescription:GetChildren() do
if description:IsA("AccessoryDescription") then
-- AccessoryDescriptions also help you get the Instance of the accessory, which will be helpful in adjustment
-- For example, we can show the user which accessory is selected by adorning a SelectionBox
local selectionBox = Instance.new("SelectionBox")
local accessoryInstance = description:GetAppliedInstance()
-- Adorn to the MeshPart Handle under the Accessory Instance
selectionBox.Adornee = accessoryInstance.Handle
selectionBox.Parent = workspace
-- setting the adjustments
description.Position = Vector3.new(0.2, 0.2, 0.2)
description.Rotation = Vector3.new(20, 20, 20)
description.Scale = Vector3.new(1.1, 1.1, 1.1)
end
end
local appliedDescription = humanoid.HumanoidDescription:Clone()
appliedDescription.Name = "AppliedDescription"
appliedDescription.Parent = workspace
Local Script
-- Accessory Adjustment local script
local AvatarEditorService = game:GetService("AvatarEditorService")
-- get the appliedDescription made from our server script
local appliedDescription = workspace:WaitForChild("AppliedDescription")
-- save the avatar with the adjustments
AvatarEditorService:PromptSaveAvatar(appliedDescription, Enum.HumanoidRigType.R15)
--same with PromptCreateOutfit to create outfits
--AvatarEditorService:PromptCreateOutfit(appliedDescription, Enum.HumanoidRigType.R15)
We’ve also updated the Avatar Rules to let you access the newly allowed AssetTypes and adjustment limits, which you can find here:
local AvatarEditorService = game:GetService("AvatarEditorService")
local avatarRules = AvatarEditorService:GetAvatarRules()
–- AccessoryRefinementTypes is a list of the allowed AssetType values
print(avatarRules.AccessoryRefinementTypes)
–- AccessoryRefinementUpperBounds is a table of the allowed upper adjustment limits for each accessory type
print(avatarRules.AccessoryRefinementUpperBounds)
–- AccessoryRefinementUpperBounds is a table of the allowed lower adjustment limits for each accessory type
print(avatarRules.AccessoryRefinementLowerBounds)
AccessoryRefinementUpperBounds
and AccessoryRefinementLowerBounds
allow you to check that your experience doesn’t apply an adjustment that can’t be saved to the platform. Trying to save values out of the bounds will clamp the values during saving.
We can’t wait to see how you incorporate these new capabilities into your experiences!
Special thanks to the team that helped make this happen: @JollySunbro6, @Peaze4ly, @gcheck14552, @cyrian_sun @Nimniteshyamalan, @LoboTheCzarnian, @legendRf20, @SergeantBlocky, @misterpebblez, @Padi_Xiaokeai, @pbloxi, @Vvhere2021, @FarazTheGreat, & @timetopretend8.