So, I have a table with the default player data I need to load/save, like below.
local DefaultStats = { Stats = { Points = 0, Kills = 0, Deaths = 0, }, }
And I'm retrieving the DataStore like this.
local PlayerData = game:GetService("DataStoreService"):GetDataStore("TestData1")
Say I add another value to save, such as "Coins = 0,", then join the game, that value does not load since it wasn't saved on the current DataStore, TestData1 originally. If I change my DataStore name to say TestData2, I lose the previous data obviously, but the new value is loaded.
I'll need to be adding new values into the DataStore as time progresses, and I can't be resetting all the player data each time.
Is this an issue with how I'm saving/loading data, or is there something I'm missing with DataStores?
You can use SetAsync to update values.
local PlayerData = game:GetService("DataStoreService"):GetDataStore("TestData1") PlayerData:SetAsync("DataName","DataValue")
The DataValue can be set with tables or dictionaries as well.