Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

GetCharacterAppearanceAsync isn't attaching Accessories?

I'm using the function of a button to load all things a player is wearing to a Model (also a Dummy). The player enters the name of any player and it should use their ID to find the searched player's clothing.

The problem is that the hats/accessories are not properly attached to the Dummy. Instead, they spawn somewhere else in the map, whilst still being in the dummy as a child. The hats/accessories should be ON the dummy.

local Player = game.Players.LocalPlayer
local Players = game:GetService("Players")

script.Parent.MouseButton1Click:Connect(function()
    --local NewPlayerID = Players:GetUserIdFromNameAsync()
    local NewPlayer = Players:GetUserIdFromNameAsync(script.Parent.Parent.TextBox.Text)
    print(NewPlayer)
    
    local Dummy = workspace.Dummy
    --Dummy.Parent = workspace
    
    local appearanceModel = game.Players:GetCharacterAppearanceAsync(NewPlayer)
    for i,v in pairs(appearanceModel:GetChildren()) do
        v.Parent = Dummy
    end
end)

This is the result: https://gyazo.com/4c95d4d6d0e248a507d30dc2720ee697 (I am the other dummy with the idle animation! My character hasn't loaded.)

1 answer

GetCharacterAppearanceAsync is not a fully working function. It only returns the items the player is working and doesn't attach them.

To get around this, you can use the Humanoid Description System.

Here's an example of how you can use this:

local userid = 62087109
local humanoid = game.Workspace.Dummy.Humanoid
-- End of settings
local humanoiddesc = game.Players:GetHumanoidDescriptionFromUserId(62087109)
humanoid:ApplyDescription(humanoiddesc)

This will load the specified user's avatar onto a Humanoid named Dummy in the workspace. You can do a lot more with this.

If this doesn't work, leave me a comment and I'll fix it.

2 comments

0

ApplyDescription() can only be called from a backend server.

0

Then use remote functions to get the text from the textbox.

This discussion is preserved as it was. New answers, comments, and votes are closed.