You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I’m trying to save and get a group of data -
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 -
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.