Help with Inventory System Concept

I’m currently working on an update to my game, and a plan I’ve had for a while is to add currency and an inventory system to my game. In depth, this would include:

Buying Currency for Robux
Buying Inventory items for currency

I’m not really sure where to start. I don’t want to overload datastores, but I’m unsure how to securely store the player’s data (currency and inventory) and keep it up to date.

So, how would I go about making a system like this?

My first attempt at a cash system was not very successful:

I’m not entirely sure how to implement these security measures, because I’m not entirely sure how to create the system. I’m more interested in concept than code, but I’m not very sure how I would properly create a system like this for security and efficiency, and not overloading datastores.

To further understand this though it would be nice to have some small code blocks to experiment with and see better how it works.

If anyone could help that would be great!

1 Like

Okay so I think the best way to approach this is to get your currency system up and running properly, then expand that system to store more types of data.

What is the current state of your currency implementation? Has it changed much since your other posts?

it’s pretty bad – i haven’t touched it much since that post
before even writing the currency system, I think I need to know how it will work, then I can try and implement what i know how to do, and request further help on stuff I don’t

clearly my implementation of it before was not secure, so how do you think i could do this effectively?

Okay so a very basic, high level overview is:

Server script handles the data store stuff. This includes:

  • initialising the data for new players
  • retrieving stored data for returning players
  • saving data for players in game

That all makes sure that players can continue where they left off from last time they played.

The server also needs to handle actually changing the data in play sessions as well. For example a player may touch a coin in the game and then receive some currency.

These in session updates usually happen frequently enough to break the limits on data store requests so a caching system is required. Examples of these are DataStore2 and ProfileService.

You’ve mentioned security issues so I’ll state a key concept that needs to be applied. The server should make the final decision on whether or not any player data should be changed and it has to account for the player being able to tell the server anything at all, true or false.

1 Like

So I can make more frequent updates and cache data with datastore2 and profileservice?

Yeah if you’re using one of those systems you can access the cached data as frequently as you want

1 Like