So in a lot of Pet Simulator games, it is often that the pets collected by the player are saved along with their individual level. I can imagine it’s saved by first creating a table like this
local Inventory = { {“Pet1”, 1}, {“Pet2”, 3}, {“Pet3”, 2} }
Pet1 for example is the pet name and the number after is the level. Let’s say that a player wants to equip a certain pet, how I would personally do it with my skill level is for a server script to cycle through the inventory table until it finds the pet which the player requests and see if the level matches.
Is there a better way to do this? For example, even having the ability to efficiency save the rarity of the pet so that a colour design can be determined, rather than creating another table to which determines which pets go under which rarity.

2 comments
partly, most inventories use dictionaries instead of arrays
May you elaborate on dictionaries? I’ve never used one but I might have without knowing