Not sure what to do next with Data Store 2

Hello I’m making a game using Data store 2, and I’m not sure where to go next.


local ds2 = require(game.ServerScriptService.DataStore2)
ds2.Combine("Data","Coins","Gems","TotalSnow","Blowers","BackPacks")
local function DeSerealize(Items,Type)
	if Type == "Blowers" then
		for _, tbl in pairs(Items) do
			local getfolder = Items[tbl[3]]
			if getfolder ~= nil then
				getfolder.Equipt.Value, getfolder.Purchased.Value = tbl[1], tbl[2]
			end
		end
	elseif Type == "BackPacks" then
		for _, tbl in pairs(Items) do
			local getfolder = Items[tbl[3]]
			if getfolder ~= nil then
				getfolder.Equipt.Value, getfolder.Purchased.Value = tbl[1], tbl[2]
			end
		end
	end
end
game.Players.PlayerAdded:Connect(function(player)
	wait(1)
	local UserId = player.UserId
	local stats = player.leaderstats
	local Coins = stats.Coins
	local TotalSnow = stats.TotalSnow
	local blowers = player.Items.Blowers
	local BackPacks = player.Items.BackPacks
	local Gems = player.leaderstats.Gems
	-- load data

	local TotalSnowdataStore = ds2("TotalSnow",player)
	local CoinsDataStore = ds2("Coins",player)
	local GemsDataStore = ds2("Gems",player)
	local dataBlowersStore =  ds2("Blowers",player)
	local dataBackPacksStore = ds2("BackPacks",player)
	TotalSnow.Value = TotalSnowdataStore:Get(0)
	Coins.Value = CoinsDataStore:Get(0)
	Gems.Value = GemsDataStore:Get(0)
	local BlowerData = dataBlowersStore:Get({
		{
			true,true, "BasicShovel"
		}
	})
	local BackPackData = dataBackPacksStore:Get({
		{
			true,true, "Pockets"
		}
	})
	TotalSnowdataStore:OnUpdate(function(NewValue)
		print(NewValue)
		TotalSnow.Value = NewValue
	end)
	CoinsDataStore:OnUpdate(function(NewValue)
		print(NewValue)
		Coins.Value = NewValue
	end)
	GemsDataStore:OnUpdate(function(NewValue)
		print(NewValue)
		Gems.Value = NewValue
	end)
	dataBackPacksStore:OnUpdate(function(NewValue)
		print(NewValue)
		DeSerealize(NewValue,BackPacks)
	end)
	dataBlowersStore:OnUpdate(function(NewValue)
		DeSerealize(NewValue,blowers)
		print(NewValue)
	end)
end)

I have started making the script as seen here.
I’m not sure where I went wrong since I’m stuck here.
If more information is needed just ask.
Can someone with knowledge in data store 2 give me a breif over view of where to go next?
Thanks.

2 Likes

Write your own datastore module.

I’ve never thought of doing that but Data store 2 is less complicated and for free though. So I’m gonna stick with that

disagree, why would you make your own when theres already some made by the best luau programmers in existance?

to learn, writing your own stuff helps you understand how it works

no

  1. I dont think you realize full on datastore modules are had to make
  2. Some of*
  3. Kampfkarren and loleris are really good, especially loleris