How to learn DataStorage etc?

Hello everybody,

Important: please dont flag this, I wasted my time with learning somthing that was absolutely wrong. and I wasted 1 Month of my time. Therefore this question is my extrem serious. To be a good Data programmar I need your help.

I seriously dont understand how I could start with DataStorage. I mean. I didnt programming so much with tables - that doesnt mean I am bad at it.

Does anyone know the right steps to learn Datastorage? - The first step doesnt need to be Datastorage it can be something else.

I didnt work that much with values is that bad?

Please tell me the steps how I can be a good DataStorage programmar and how I can learn everything with a “learn structure” but give me a little big list with min 10 things. Thanks!

I just want understand everything with Data, and how to save things in Roblox. Like making a sword that spawns everytime in ur slot or making my own money system. Could anyone help please?


I hope someone answers you with some code or explanation so that you can learn much better, for my part I know the basics and I really need to keep learning and improving what it is to manage a DataStore, I comment to know other comments, greetings!

Local WeaponData = game:GetService("DataStoreService"):GetDataStore("Weapons V.01") 

game.Players.PlayerAdded:Connect(function(Player)   -- playeradded function will give u the player reference always use it.
local Weapons = nil
local success, error = pcall(function()  
  Weapons = WeaponData:GetAsync(Player.UserId)  
if success then
  if Weapons then -- if the player has weapons then give him the weapons.
       for i,weaponname in pairs(Weapons) do  -- weaponname is a string, it's simply the name of the weapon that's stored.
              game.ServerStorage.Weapons:FindFirstChild(weaponname):Clone().Parent = 
                  Player.Backpack    -- find the weaponname inside of the weapons folder that already exists in the game
  -- game.ServerStorage.Weapons:FindFirstChild("WeaponName"):Clone().Parent = Player.Backpack  
if not success then
Player:Kick("go wash the dishes while roblox fixes their servers")

weapons = {}
     for i,weapons in pairs(Player.Backpack:GetChildren()) do
      table.insert(weapons, weapons.Name)
WeaponData:SetAsync(Player.UserId, weapons)        -- You can only store the name of the weapon, not the weapon itself.

If you want to get more complex you can also store the upgrade values of the weapons too like.
{ {WeaponNames} ,{ TheirDamageValues }} – but the damagevalues need to be tables too which u’d only need to store in for example {4, 5 ,10 , 2} and the server will automatically in that order find the WeaponNames and run through the table of those values to change those values accordingly.

To conclude, you can only store strings or number values in your datastores.

You use those stored strings to loop through the game files and to copy those objects referenced by those stored strings into what you want to happen.

That’s really it.

I think it looks somewhat complicated for her to understand and it is necessary to perform the if successes and if it fails to save, will it be possible for you to correct the code a bit for better understanding, please? sorry about that… :frowning:

constructive comment

no I understood the comment. but it didnt answer really my question :confused:

Please tell me the steps how I can be a good DataStorage programmar and how I can learn everything with a “learn structure” but give me a little big list with min 10 things. Thanks!

Edit: I want a learn plan how I could get my steps to be a good Data programmar

I share with you this code that I use to understand how datastore works much better, all this is customizable to your liking and when you understand much more about programming you can modify it to your liking with values int, bool, etc. So far this is what I handle, I lack much more deep understanding of this.

-- DataStore System
local DataStore = game:GetService("DataStoreService")
local PlayerData = DataStore:GetDataStore("playerGold")

	local playerFolder ="Folder", player) -- create a folder in the player
	playerFolder.Name = "Data" -- Named the folder as Data

	local Gold ="IntValue", playerFolder) -- instance int value Parent to the folder
	Gold.Name = "Gold" -- named the int value as Gold

	-- Load data -- loading data here
	local data
	local key = "Player_".. player.UserId
	local success, errormessage = pcall(function()
		data = DataStore:GetAsync(key)

	-- if success
	if success then
		Gold.Value = data
	elseif data == nil then
		print("gold has been saved.")
		print("error saving data, error saving data!!!")

My dataStorage needs to be fixed for when the player exits the server and I have not done that yet

If anyone could help with that part we would all appreciate it very much

You haven’t really understood programming until you experienced 10,000 hours of headaches.

In all seriousness, look at free models and try to reverse engineer them. Overtime you’ll start to understand what the code means. The easy part is coming up with what you want the code to do.
The hard part is translating what u want it to do into code.

1 Like

We all have different ways of learning, you can’t say she hasn’t learned anything, she’s just taking her a little longer, no one here is a genius

It would be ideal for everyone to contribute something positive to the topic, it would really be very useful if they shared their experiences in datastorage.

1 Like

When using DataStore, you fist must understand the few steps needed to make a proper working DataStore. You can look up tutorials such as AlvinBlox or TheDevKing.

First, you get the service, aka “local datastore = game:GetService(“DataStoreService”)”

Then, you want to get the DataStore, you can do this by calling another variable. “local data = datastore:GetDataStore(“data”)” or if you want, you could do it on a whole line:

“local datastore = game:GetService(“DataStoreService”):GetDataStore(“datastore”)

Once you do that, you can use datastore in many shapes and sizes you want. Here are some codes that help you with datastore:

GetAsync() - do this first when doing datastore. This is loading the data.

SetAsync() - do this second. This saves the value (preferably IntValue) that a player currently has, usually done when player leaves (aka game.Players.PlayerRemoving)

local success, error = pcall(function() - this helps if roblox breaks, and warns you if data store doesnt work. This will give you an option to either shut down the game you made to stop players from loosing data, or leave it up because you want to.
Pcall also helps with identifying errors you make with datastore.

Research for info on datastore.


Hello, excuse me, but how would the configuration be done for when the player leaves the server?

What is the difference between Datastorage and Datastorage2 and why do people save with tables still instead of using Datastorage/2

1 Like

I believe and am almost sure that that is a plugin

I once read that data storage isn’t that good to save too much because the game’s latency went wrong.

edit: Sorry I am not so good at english

1 Like

Here Alvin talk about datastorage2 I hope it is useful for you:

Usually done after you load data. For example,


(loading data script)

When saving data, you want the script to save the value of a player the very they leave.


(saving data script)

We dont want to save the data first, otherwise its like resetting data of a player, and DataStore will be completely useless.

1 Like

If you need additional information alongside the other resources provided by the others in this thread, the Roblox Developer Hub has articles which cover DataStores, saving player data, etc.

DataStores Article

Saving Player Data Article

DataStore Errors/Limits Article

Ah so, in case of learning that I would prefer first to learn Data Storage and test my things because I dont think I will need that in my first times of development?

I think I will need Datastorage 2 when I release my game. Or?

I recommend you take a programming course, once you have the basics you can read the code and understand much better what each thing does, on this page you will find programming information with lua: Lua / C# Comparison ( To learn more advanced things with the language: Lua Tutorial - Tutorialspoint and finally to learn datastorage from scratch: Datastore Tutorial for Beginners - Resources / Community Tutorials - DevForum | Roblox I hope it is useful to you, I use it very often to learn and I speak Spanish so the language does not matter. :smiley:

1 Like

yes, but there are some functions Roblox Studio doesnt use. Should I still learn on it?