Table being mistaken as string

Im making a crafting system for a game I work for. Im using a modulescript for the recipe data. When I loop through the modulescript and get the tables inside of the modulescript it says theyre a string and I cant loop through them. Any idea whats happening?

Error:

ModuleScript:

local module = {
	DioDiary = {
		Slot1 = "Arrow";
		Slot2 = "Rokakaka Fruit";
		Slot3 = "Rokakaka Fruit";
		Slot4 = "Arrow"; 
		Output = "DIO's Diary"
	},	--Test Recipe [ebic]
}

return module

Script: local recipes = require(script.Parent.CraftingRecipes) for i,v in pairs(recipes) do for i2,v2 in pairs(i) do print(v) print(i) end end

do for i2,v2 in pairs(i) do print(v) print(i) end end

i returns the index which is a string in this case, you’d wanna do v instead:

for i2,v2 in pairs(v)

Your issue here lies in your 2nd for loop here:

for i2,v2 in pairs(i) do

Your nested array DioDiary is at the index of your module table, which is the declaration name of the array, hence a string.

All you need to do in order to fix this is change your 2nd for loop to the following:

for i2,v2 in pairs(v) do

This way, you’re accessing the value assigned to the DioDiary string instead, which is an array.