DataStore2 is being used in two places in the same experience, would that be part of the issue? I do not see why it would, but I don’t have any better guesses.
Edit: I got it figured out. If anyone else has this issue, just read through issue #135 on the GitHub repository
How well is datastore2 able to handle a value that changes quickly over a period of time, that may need to save? I am making a sort of resource managing game, and the resources may change quickly. I want these resources to save.
Hi there, my game has been using DataStore2 for a while now but we implemented a “quests” feature which saves a table and has worked for a while. On release, players were being given random default values their first time in the game which showed them having made very odd progress on quests. Any ideas how we could be calling the wrong data?
I have found a major issue with the latest version of DataStore2.
When loading multiple DataStores with multiple players, it takes a while for everything to load.
Here is a screenshot from a YouTube video with 6 players inside.
I have a Dev Build of the next update for my game that uses ProfileService and the issues that DataStore2 have are nonexistent…
Here is an example of what the DataStore2 scripts looked like:
local DataStore2 = require(game:GetService("ServerScriptService").DataStore2)
local CombinedDataStore = DataStore2.Combine("PlayerData", "PlayerDataBackup")
local DefaultTable = {
["MultiplayerWins"] = 0,
["BattleWins"] = 0,
["IsWinObby"] = false,
["IsLikedGame"] = false,
["VersionPlayed"] = "4.0"
}
game:GetService("Players").PlayerAdded:Connect(function(Player)
local DataStore = DataStore2("PlayerData", Player)
local DataTable = DataStore:GetTable(DefaultTable)
local Data = Instance.new("BinaryStringValue")
Data.Name = "PlayerData"
Data.Parent = Player
for DataType, Value in pairs(DataTable) do
Data:SetAttribute(DataType, Value)
end
for DataType, Value in pairs(DefaultTable) do
if not Data:GetAttribute(DataType) then
Data:SetAttribute(DataType, Value)
end
end
Data.AttributeChanged:Connect(function()
local DataToSave = {}
for Map, Value in pairs(Data:GetAttributes()) do
DataToSave[Map] = Value
end
DataStore:Set(DataToSave)
end)
end)
I expect 8 to run at the same time when a player joins. It loads instantly just fine with 1 player, but when 2 or 3 join, data takes a long time to load.
I would love to work with you to fix this major DataStore2 issue, I will give you all the info that you need to fix the issue.
Don’t worry I got it to fix. I messaged the other scripter and he forgot to add something, so all you would have to do it check if it doesn’t exists then add it to the data store.
Any idea why this error happens? Ever since I replaced some gets with gettable this happens and I think this throws an error and prevents the rest of the script from running
No, what they mean is the input value (100 in this case) is the user-set default value.
Rather than setting the default and then overriding it if there is existing data (as is done with regular datastores), this checks if there is data first and sets the value to whatever your inputted value is in the event of no data