Datastore2 makes no sense

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I’m trying to save and get a group of data
  2. What is the issue? Include screenshots / videos if possible!
    the getasyncs keep giving me “expected string, got table” i also dont understand this at all, and would prefer not even using it, but my other datastore kept deleting my data and this just makes literal no sense
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    no one has the same question, theyre all about saving tables and stuff, i heard it saves them all together if you use combine so i did combine and its giving me table errors that i cant get past
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local dataStore2 = require(game.ServerScriptService.DataStore2)

game.Players.PlayerAdded:Connect(function(player)
	
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player
	
	local plrInfo = Instance.new("Folder")
	plrInfo.Name = "plrInfo"
	plrInfo.Parent = player
	
	local mone = Instance.new("IntValue")
	mone.Name = "mone"
	mone.Parent = leaderstats
	
	local position = Instance.new("StringValue")
	position.Name = "Position"
	position.Parent = plrInfo
	local company = Instance.new("StringValue")
	company.Name = "Company"
	company.Parent = plrInfo
	local exp = Instance.new("IntValue")
	exp.Name = "exp"
	exp.Parent = plrInfo
	local objective = Instance.new("StringValue")
	objective.Name = "Objective"
	objective.Parent = plrInfo
	local objectiveReciever = Instance.new("StringValue")
	objectiveReciever.Name = "objectiveReciever"
	objectiveReciever.Parent = plrInfo
	
	local moneStore = dataStore2("mone", player)
	local positionStore = dataStore2("position", player)
	local companyStore = dataStore2("company", player)
	local expStore = dataStore2("exp", player)
	
	dataStore2.Combine("stats", "mone", "position", "company", "exp")
	
	mone.Value = moneStore:GetAsync(200)
	position.Value = positionStore:GetAsync("Unemployed")
	company.Value = companyStore:GetAsync("Unemployed")
	exp.Value = expStore:GetAsync(0)
	objective.Value = "None"
	objectiveReciever.Value = "None"
	
	mone.Changed:Connect(function()
		moneStore:SaveAsync()
	end)
	
	position.Changed:Connect(function()
		positionStore:SaveAsync()
	end)
	
	company.Changed:Connect(function()
		companyStore:SaveAsync()
	end)
	
	exp.Changed:Connect(function()
		expStore:SaveAsync()
	end)
end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

You are able to delete the template text when you make a topic.

I don’t use DataStore2 so I can’t help you. But according to most, DS2 is inferior, especially with DataStore 1.1 coming soon.

AlvinBlox video on DS2

I use and recommend ProfileService

2 Likes

Could be cause Combine should only be used once, you’re using again after a player joins, put it before the PlayerAdded event

Also, where exactly is it erroring?

line 42 aka position.value, mone value just gives you 0,there might already be data for mone so idk

COuld it be that there’s already data in the Position key that has a table? Try doing what I mentioned by putting the Combine line before the PlayerAdded event and maybe change stats to something else?

well now its saying its trying to call something that doesnt exist and isnt putting default value for some reason

use quick network it’s better! QuickNetwork - A powerful hybrid alternative to ProfileService and DataStore2

1 Like

QuickNetwork might be good, the reason I use ProfileService over QuickNetwork is because QuickNetwork doesn’t seem reliable right now.

(if you look through the thread you’ll see a lot of “major bug fix” patches)

Quicknetwork is regularly updated, which is why you mainly see those bug fixes. Just because it gets updated regularly doesn’t mean it isn’t reliable, :man_facepalming:. Bug fixes are very important and should be fixed immediately! If you ever even read ProfileService’s source, there are quite a lot of edge cases which they don’t handle and the data corruption they handle is completely useless, because its user data corruption, not Roblox internal data corruption.

ProfileService also saves data redundantly and even some of its edge case handling are bloated and ProfileService is way less flexible or controllable than QuickNetwork.

I highly encourage you to test out both and see which one is really reliable, instead of mis spreading information regarding my module.

Sorry for super duper late reply but I can assure you it is reliable as I use it myself.

1 Like