Bug with GetCharacterAppearanceAsync

Heya.

So, apparently the " GetCharacterAppearanceAsync" does not workas expected (I provided a screenshot below showing what it does).

Code I used:
https://developer.roblox.com/api-reference/function/Players/GetCharacterAppearanceAsync

Result: http://prntscr.com/o7j5vz

Hey, so based on what I’ve seen here, the function is doing exactly what it’s supposed to do.

It returns a model of all the items the player is currently wearing. In order to utilize it, you’d have to iterate through the model and parent those items into the player’s character, and apply additional logic to the other elements in the model if you need to utilize those as well. (like the rig values, height, and all that stuff.)

3 Likes

Frankly, it would be easier for developers to avoid this as I’m not even sure how I’m going to do what you provided. Why isn’t this being done automatically?

I mean, the function is made to return a group of elements that the character is currently wearing, so you can do with them as you wish.

An example of how you could actually apply these items to a character could be:

 local the_character = game.Workspace:WaitForChild("Syclya")
 for I,item in pairs(game.Players:GetCharacterAppearanceAsync(Player_UserId):GetChildren()) do
       item.Parent = the_character
 end
2 Likes

I’m not sure what you’re wanting to do with GetCharacterAppearanceAsync, but like @C_Sharper said, I’m pretty sure the function is working like it is intended. While the items returned by the function may not seem useful, there are a two APIs Roblox provides to make the problem a lot more tackle-able.

A simple method of applying an appearance to a player is to use the Player.CharacterAppearanceId property. This allows you to change a player’s appearance to any other players you wish, it’s a simple method and can get the job done, but it does have many limitations and could cause issues depending on the context of its use.

If the previous method isn’t working, or you just want to go more in-depth with changing character appearances, the new Humanoid Description System might be helpful for you! It’s a much more versatile way of changing character appearances. There’s all kinds of demo code on the wiki article that I highly suggest taking a look at.

I hope this helps, and I wish you luck with your project!

I’ll explain a bit more what I tried doing:

I’d like a auto updating model based on userid which includes packages, etc, anything on the character basically. I was planning to update that every x seconds in games but not sure if that’s even possible like that.

I see. I believe it’s possible, but it could end up putting a lot of stress on both the server and clients. I’d recommend just creating a Avatar Refresh button somewhere. I believe the Humanoid Description System could help you do this, but I’m not sure, so I’d advise looking into it.

This isn’t a bug, GetCharacterAppearanceAsync is functioning exactly as intended. It returns a model of the specified player’s avatar when called.

Automatically applying assets would be absolutely terrible and code can’t assume your intentions, so obviously it’s not going to automatically apply assets. That’s behaviour you need to code yourself by iterating through the model and applying assets as needed.

The function Players.GetHumanoidDescriptionFromUserId does exist, but this is pointless on NPCs as they can’t use humanoid descriptions. Therefore, you’re anchored towards iterating through the model returned by GetCharacterAppearanceAsync and applying assets manually.