New API For Equipping Assets on Humanoid Player Avatars

Sure,

A lot of the code is needless, its definitely in a rough state. And I offer no warranties haha

5 Likes

Any time estimate on features for NPCs? Deciding if I should do a custom implementation or wait for official Roblox API

1 Like

Apparently, whenever the game encounters a HumanoidDescription with a “Content Deleted” item, it just ends up not loading the character at all.

In this instance, I’m trying to load in a specific user, but this user is wearing a moderated shirt so I cannot load in that character at all until he or she updates his or her avatar.

Instead of handling the exception in a game that relies on this mechanic, it just ends up throwing an error stating that “Humanoid::ApplyDescription() Assets are incorrect for the Humanoid Description slots they have been assigned to.”

For now, a temporary fix for the problem on my end would be to pcall the function, then if there is an error it would just load a placeholder, but I still do not get why Humanoid:ApplyDescription() cannot handle anything that is “Content Deleted.”

5 Likes

Some else I believe I should add: The shirt is content deleted but still visible on the user in both 2D and 3D. :thinking:

1 Like

I found that if I wait for at least one player’s character to load in before trying to apply HumanoidDescriptions to an NPC it successfully applies the HumanoidDescription to the NPC. Is it safe to build my game/NPCs on top of this “bug”, or will something be changing in the future that will break this?

The HumanoidDescription system will shortly be supporting NPCs, so you should be safe to keep doing what you are doing, and once NPCs are supported you will not need to wait for a player character to load

4 Likes

Thanks for the reply. I can’t wait for it to be actually supported!

Also, do you know if there’s any way to keep a set of custom “/e” emotes while also using this system? It won’t allow me to keep a custom animation script in the game & even if I wanted to I also want to allow players to use any set of animations that they’d like to. Not sure how to add custom emotes if the script is constantly being re-inserted.

You’d need to edit the chat modules to do that.

1 Like

I’m pretty sure the chat modules no longer carry that functionality, it was all moved to the Animate script.

I love the new feature,
I created 64 accounts and recorded their user id’s. This gives me a library of 64 avatars that I can convert players into. The head issue has been mentioned by a few. This is where the head may not be in the right place when moving between R standards. My solution was to simply call the function a second time after a short wait. The other part of the trick was to lock the user out from calling the transform function for 5 seconds. This way the function can make clean calls without conflicts that could be generated by impatient clickers.

local module = {}
local locked = false
locked = script.Locked.Value

if not locked then
locked = true
function module.execute(player,avatar,avatartracker)
local humanoid = player.Character and player.Character:FindFirstChild(“Humanoid”)
if humanoid then
local humanoidDescriptionForUser = game.Players:GetHumanoidDescriptionFromUserId(avatar)

			humanoid:ApplyDescription(humanoidDescriptionForUser)
			wait(.25)
			humanoid:ApplyDescription(humanoidDescriptionForUser)
			wait(2)
			
			player.records.AvatarLast.Value = avatartracker --I have records to keep track when a player rejoins.

locked = false
	end
end

end

return module

Here is a link to my game:

Once I get promoted, I’ll post sample images.

You shouldn’t have to apply the description twice to get the correct behavior. Do you have an example of code which doesn’t work? I can look into it and see why it’s broken.

1 Like

Any ETA on when HumanoidDescriptions will be officially supporting NPCs? I’m using a sort of hacky way right now and it causes some visual bugs for whoever the first player to join the server is.

Loving the easier way to apply bundles to players, but I’m a bit frustrated over the non-support for decals as a shirt/pants. Still trying to find a way to bypass this.

2 Likes

Did you try an Image instead of a Decal? I’m not sure if this would work because HumanoidDescriptions are pretty picky, but it’s worth a try.

I was putting in the Image ID in the Shirt/Pants section and my avatar with the HumanoidDescription had the other aspects applied, but there wasn’t even a Shirt/Pants instance put in.

1 Like

You will now be able to call Humanoid:ApplyDescription() on an NPC without having to wait for a character to spawn. You can also now call Humanoid:ApplyDescription() on a StarterCharacter. The 'Best Practices / Caveats` section of the documentation will shortly be updated to reflect this.

6 Likes

This is great, thank you.

Do we have an ETA for non-owned custom assets? I believe this is the final limitation dissuading developers from using the API.

Actually, unfortunately a bug has come up, so we’ve had to turn off the functionality to use Humanoid:ApplyDescription() on NPCs until we can fix the bug. Once we have a fix the functionality will be turned back on though. I will also let everyone know here.

4 Likes

I appreciate the NPC support, this will make a big difference when it comes to RPGs and stuff like that.

HumanoidDescription properties like ShirtId or PantsId use the Ids that you can find on the website unlike the Shirts instance and the Pants instance which use something that I would consider as a real id… :s Getting a bit annoying since I have to display the shirt of the player for the character customization, but he also needs to wear it… Walking around with two different ids is a bit heavy