Generate NFTs with this Simple Code Part 1 - Issues

I have two problems.

First: Followed all the steps, but I’m getting the error: use random rarity common
Math.random() * layer.elementIdsForRarity[rarityForLayer].length

TypeError: Cannot read properties of undefined (reading ‘length’)

Tried everything I can think of. No idea why this is happening.

Second: I’ve seen this a lot on the forum, really frustrating, but can you PLEASE explain how to edit the rarity weights? I tried creating more rarities following the already established syntax and it’s not working.

Thank you

I don’t know the reason, usually there are problem where the files are not found on disk, you could try to add some logging to see how is that layer.elementIdsForRarity[rarityForLayer] is undefined

you could try with fewer files