I’m developing a system for a game which includes the use of client-sided rigs that follow the player. At various points, accessories are added/removed from these rigs. This cannot be done through normal means as humanoid:AddAccessory() can only be used on the server.
The custom world-loading system for this game is also client-sided, meaning I cannot make these rigs server-sided as they’ll just fall through the floor and/or have unintended effects as seen in the below video:
Is there a publicly available alternative to the humanoid:AddAccessory() API (such as a function or utility module) that can be used in a case like this?
You could manually place it by creating a weld and positioning it based on the respective attachment
local function addAccessory(rig: Model, accessory: Accessory)
local handle = accessory:FindFirstChild('Handle') :: BasePart
local attachment = handle:FindFirstChildOfClass('Attachment') :: Attachment
for _, child in rig:GetChildren() do
if not child:IsA('BasePart') then
continue
end
local correspondingAttachment = child:FindFirstChild(attachment.Name)
if not correspondingAttachment then
continue
end
local weld = Instance.new('Weld')
weld.Name = 'AccessoryWeld'
weld.Part0 = child
weld.Part1 = handle
weld.C0 = correspondingAttachment.CFrame
weld.C1 = attachment.CFrame
weld.Parent = handle
end
end