Ways I can improve my knowledge and grasp DataStores better

Hello!

I’ve finally gotten good enough at scripting to be able to start on small personal projects and other things as well. I have been slowly inching closer to being able to start work on a small game for better practice and such. I want to make the game have a datastore within it to prevent people from losing their data half way through but I end up becoming stuck in certain areas and aspects when it comes to it. I always question how people save whole inventories with datastore or how people can manage to send datastore to a sub-place. Sometimes I try to replicate it from what I think they do it, but I keep either messing up or getting stuck in certain sections. I would like to know how people manage their datastore stuff and manage to save whole lots of data. Usually stuff like item skin inventories, how they can send the data from then main place to a sub-place, how people can check for if the player owns something (ex. like how in certain games there’s a collectable object that only appears if you haven’t collected it), and more potential tips and facts that could help me.

(Sorry if this post felt a bit weird to read or if I kept repeating myself it’s my first forum post and I kind of forced myself to write this :fish: )

I would recommend trying out ProfileService for storing your game data. It has a getting started tutorial that explains stuff and explains how to use it. It also gives you experience using someone else’s library in your game, and it has loads of stuff like autosaving and serverlocking built in (meaning players should never lose data).

https://madstudioroblox.github.io/ProfileService/

You can look on the documentation about DataStoreService, which contains almost every method you can use on it.

For good practices on how to use it, you can go to a Roblox documentation on Saving Data.

Notes:

  • You can only store normal data types (e.g. number, string, table, etc…)
  • Do not make data store requests often. If you have too many requests, they get placed in a queue, and if that queue fills, some requests will be ignored, which can make you lose data.
  • Data must not exceed 4 megabytes.

You can think of an inventory as a list of items that you have. This is how an inventory can be stored:

{
    [1] = { -- Item in slot #1
        ...
    },
    ...
}

DataStores are unique per universe (a game in Roblox terms), but not per place (or sub-place, as you called it). If you have a universe that contains 100 different places in it, all of them can access the same DataStore.


You can have a list called collectibles, which stores what you’ve collected in the game.

{
    collectibles = {
        "collectible 1",
        ...
    }
}

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.