Indexing nil somehow?

Hey, today I was working on an inventory system it went pretty well (refering to this post How to insert a table inside a table? - #23 by CodeProto)

So basically in clip 1: - YouTube (as you can see I can add cannon with no problems at all)

clip 2: - YouTube (here me trying to add another tower in different rarity)

Module:

SS: image Error on this line

Edit: the issue is in clip2 btw
and here is the zoomed out ss script if you can’t see

error on line 13, the inventory table does not have “Rare” indexed at “Turrets”

before local findItemInv = inventory[itemType][rarity][item] you should add:

if items[itemType][rarity]==nil then
items[itemType][rarity]={}
end
1 Like

I guess this is because the data saved does not have that index existing

1 Like

I fixed it yesterday I forgot I didn’t put the rarity table inside the player :sweat_smile: