Best way to make an inventory system

I’m going to be making an inventory system for my game soon. I’ve made some before but they are a bit wacky.

Players will store items like crafting materials and weapons and abilities. The materials will be stackable but not the weapons. Each weapon will be unique even if the player has 2 of the same weapon, because each weapon will have a randomly generated level requirement and a random “enchantment” on it. They will also be given a random rarity. How would I store these items in an inventory? Should I use a key system with Guid?

Bumping this thread cause still looking for some answers.

Use a table such as profile service tables

local inventory = {}

just insert stuff into the table

Yes but how should I store each item, also I see people using IDs, but what is the point of them

I meant sorry my question actually just is what’s the point of people using IDs.

Also, is it better to save the data when the player leaves, or update the player’s data when they remove or add an item?

The main thing of having IDs is to prevent duplication. And for the saving I would probably recommend when the player leaves since it also stores the added and removed items.

For replication to the client is it better to have instance values in a folder inside the player or to fire a remote every time the server changes the player’s inventory