HumanoidDescription:GetAccessories() doesn't work consistently?

local function RetrieveIdsFromHumanoidDescription(HumanoidDescription)
		local Items = {}
		local Accessories = HumanoidDescription:GetAccessories(true)
		for i, v in ipairs(Accessories) do
			print(i,v)
		end

		for _, AccessoryInfo in pairs(Accessories) do
			table.insert(Items, AccessoryInfo.AssetId)
		end

		for _, BodyPartName in pairs(BodyParts) do
			local BodyPartId = HumanoidDescription[BodyPartName]
			if BodyPartId ~= 0 then
				table.insert(Items, BodyPartId)
			end
		end

		

		if HumanoidDescription.Shirt ~= 0 then
			table.insert(Items, HumanoidDescription.Shirt)
		end

		if HumanoidDescription.GraphicTShirt ~= 0 then
			table.insert(Items, HumanoidDescription.GraphicTShirt)
		end

		if HumanoidDescription.Pants ~= 0 then
			table.insert(Items, HumanoidDescription.Pants)
		end

		if HumanoidDescription.Face ~= 0 then
			table.insert(Items, HumanoidDescription.Face)	
		end

		return Items
	end

:GetAccessories() returns an empty table sometime, especially in-game. I tried testing within Studio the problem does not seem to arise that much as it is in-game. Any approach would really help :slight_smile: !

2 Likes

Have you tried: = players:GetHumanoidDescriptionFromUserId(player.UserId)
And I’ve found when getting the Description right everytime there needs to be a slight pause from after the Character is loaded. task.wait(0.33) will do.

The slight wait was the solution :slight_smile: I really appreciate it:D

Took me weeks to figure that out… There is even a command that waits for the Description to be loaded that don’t even work right all the time. But that made me think, what about just a pause. Ended up working it down to 0.33 being stable.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.