How does one turn funny HumanoidDescription accessory lists into a table? cause i have no clue

I’m trying to make a table out of… whatever Roblox did with Humanoid Description’s whole Accessories list, but I have no clue on what to do.

Roblox formatted Accessory"TYPE" lists this:
632, 636363612, 9036616994
instead of:
[1] - 632,
[2] - 636363612,
[3] - 9036616994

I tried ipairs, #, and crying and dying to allergies (skip that one), and there’s no way I’m going to go back to using the default system of apparently committing crimes against Intellectual Property and SPAMMING PLAYERS.

-- LEGACY SCRIPT
	local plr = player
	local desc = game:GetService("Players"):GetHumanoidDescriptionFromUserId(player.UserId)

	for i,v in desc.HatAccessory do
		local item = 	game:GetService("InsertService"):LoadAsset(v)
		item.Parent = folderlist
		local tag = Instance.new("NumberValue") -- saves ID for other scripts
		tag.Parent = item
		tag.Value = v
	end

yes… this is a panicked response to roblox’s new policy changes, 1 week notice? why?!

1 Like

The documentation says that HatAccessory is a string of hat accessories id separated by commas.

Just split the string using string.split() and the comma as the separator.

-- LEGACY SCRIPT
	local plr = player
	local desc = game:GetService("Players"):GetHumanoidDescriptionFromUserId(player.UserId)
	
	local hatList = desc.HatAccessory:split(",") -- the same as string.split(desc.HatAccessory, ",")
	for i, v in ipairs(hatList) do -- ipairs is faster than pairs
		local item = game:GetService("InsertService"):LoadAsset(v)
		item.Parent = folderlist
		local tag = Instance.new("NumberValue") -- saves ID for other scripts
		tag.Value = v
		tag.Parent = item
	end
2 Likes

Didn’t know that existed, thanks for the help!

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