Error - Table expected, got Number

This is the part of the code that runs it through, error is in line 91:

Basically, I’m fetching the whole HumanoidDescription; however, the Accessories category inside of a Humanoid is consisted of a string with IDs that need to be separated by a comma, hence why it’s in a different statement in that image. As for the rest of the categories, they all go by singular IDs, so that’s not necessary.


This is the full code:

local EmptyData = {
		["Accessories"] = {
			["BackAccessory"] = {},
			["FaceAccessory"] = {},
			["FrontAccessory"] = {},
			["HairAccessory"] = {},
			["HatAccessory"] = {},
			["NeckAccessory"] = {},
			["ShouldersAccessory"] = {},
			["WaistAccessory"] = {}
		},
		["Animations"] = {
			["ClimbAnimation"] = 0,
			["FallAnimation"] = 0,
			["IdleAnimation"] = 0,
			["JumpAnimation"] = 0,
			["RunAnimation"] = 0,
			["SwimAnimation"] = 0,
			["WalkAnimation"] = 0
		},
		--["BodyColor"] = 0,
		["Package"] = {
			["Face"] = 0,
			["Head"] = 0,
			["LeftArm"] = 0,
			["LeftLeg"] = 0,
			["RightArm"] = 0,
			["RightLeg"] = 0,
			["Torso"] = 0
		},
		["Clothes"] = {
			["Shirt"] = 0,
			["Pants"] = 0,
			["GraphicTShirt"] = 0
		},
		["BodyColor"] = 0,
		["Scale"] = {
			["BodyTypeScale"] = 0,
			["DepthScale"] = 0,
			["HeadScale"] = 0,
			["HeightScale"] = 0,
			["ProportionScale"] = 0,
			["WidthScale"] = 0
		}
	}
	--fetch existing description
	local DescriptionData = game.Players.LocalPlayer.Character.Humanoid:GetAppliedDescription()
	for category,values in pairs(EmptyData) do
		if category == "Accessories" then --Accessories
			for name,tables in pairs(values) do
				local AssetTransfer = tostring(DescriptionData[name])
				local Split = AssetTransfer:split(",")
				EmptyData[category][name] = Split
			end
		else --Other forms that require a singular ID
			for name,tables in pairs(values) do
				EmptyData[category][name] = (DescriptionData[name])
			end
		end
	end

Any help is appreciated!

1 Like

Update:

It basically runs through and fetches the IDs, but it still brings that error up.

What seems to be causing it tho? By using this code, it can easily be replicated to test the error. Give it a try!

That’s because BodyColor is a number, not a table of elements.

1 Like

omg, I totally forgot about adding the BodyColor bit; Let me test it out and I’ll be back in a second.

Yeah, it was definitely that; how come I didn’t notice!

Thanks a lot!