Invalid argument #1 to Pairs (table expected, got Color3)

Ok I guess i’m getting abit sleepy here. Are you sure that the value being passed as index is correct?

1 Like

Most likely; basically, alongside the error, it does show up search results (for an example, 6 items matching up). But it’s preventing me from executing the rest of the code.

I’ll post the Catalog variable in a bit, maybe it’ll help!

I’ll give this a try as well. (3o chars)

Just to be sure put prints in every for loop like this

for categoryindex,category in pairs(Catalog) do
	print(categoryindex, category)
	if category ~= "Skintones" then
		for subcategoryindex,subcategory in pairs(category) do
			print(subcategoryindex, subcategory)
			for index,value in pairs(subcategory) do
				print(index, value)
				local stringword = subcategory[index].Name
				if string.find(stringword,SearchKeyword) then
1 Like

Catalog variable:

local Catalog = require(ReplicatedStorage["Catalog API"])

(Catalog API) return {
	Animations = require(script.Animations),
	["Body Parts"] = require(script["Body Parts"]),
	Clothing = require(script.Clothing),
	Collectibles = require(script.Collectibles),
	Featured = require(script.Featured),
	UGC = require(script.UGC),
	Skintones = require(script.Skintones)

(Body Parts) return {
	Characters = require(script.Characters),
	Faces = require(script.Faces),
	Heads = require(script.Heads),

(Characters) return  {
	[1] =  {
		["Creator"] = "Roblox",
		["ID"] = 667,
		["Name"] = "Oldschool Animation Pack",
		["OutfitID"] = 131929448,
		["Price"] = 80,
		["Type"] = "UserOutfit"

Here’s an example of the tree, tried to make it as short as possible.

try using subcategory[value].Name

Line 155:
print(subcategoryindex, subcategory)

Line 152:
print(categoryindex, category)

How are Skintones still messing this up? LMAO

When using that line, it says this:
09:57:52.588 Players.OueIIet.PlayerGui.CatalogAPI_UI.Catalog API:158: attempt to index nil with ‘Name’ - Client - Catalog API:158

In that case replace
if category ~= "Skintones" then
if category ~= Catalog.Skintones then

pretty sure this is the issue

It may be surprising, but that actually did the job! Lua is confusing sometimes and it’s ridiculous what the program tends to ask.

Thanks to everyone who helped contribute to this.

The way this is all set up is very confusing to me.

local categories = {"Animations", "Body Parts", "Clothing", "Collectibles",
"Featured", "UGC", "Skintones"}

local Catalog = {}

for _, category in pairs(categories) do
    Catalog[category] = require(script[category])

return Catalog

Or you could do like:

local Catalog = {}

for _, categoryModule in pairs(script:GetChildren()) do
    if categoryModule:IsA("ModuleScript") and Catalog[categoryModule.Name] == nil then
        Catalog[categoryModule.Name] = require(categoryModule)

return Catalog

Just realized this was solved. Still gonna post this just for anyone who might learn from it.

1 Like

Might check that route out as well! Thanks for posting it.