What is the most efficient way of storing player's custom inventory content

Hello everyone,

I’m currently working on a custom inventory system. However, I’m not sure what is the most efficient way to store inventory content that the local script of a player can access (for UI).

I came with a few idea:

the first one being storing them in a folder in the player instance as string values like this:
Capture

the second one is storing all players’ inventory content in a single module script but the problem being that if I put it in the server storage the client would have no way of accessing it and if I put it in replicated storage the player can basically know every player’s inventory content.

does one of these ideas work? Or is there a better way to do it? Keep in mind that my game will have a lot of players in a single server (around 50-60 player).

Thank you.

Rightly or wrongly, I use your first method and it works OK. I don’t know how well it scales if the player has hundreds of items though, but it is quick and easy to reference.

1 Like

what about just storing one player’s inventory in a module script instead of storing all of the players inventory?

I’m creating a game with around 60-50 player per server which is why I’m trying to make 1 module script store everyone’s data, as it’s quite difficult to make 60 different module scripts and maintain them.

the best approach i could think of is just storing it in a folder (as tools)

when player character added
  for _, tool in player.inventory do
    tool.Parent = player.Backpack
1 Like

I have heard that instances effect performance and I’m trying to optimize my game as much as possible so I’m not sure if that would be performance friendly or not

I mean, if you have 50-60 players in a single server then creating a dictionary inside your data managing script that contains each player’s data with the player being the key would b fine, and just replicating the data to the client on player join AND on an on change basis through remote events