I’m really at a loss here. I’m not sure how, but my recent adoption of DataStore2, known for it’s insanely low data loss rate, has caused the game I work on to experience unprecedently high levels of data loss.
This was a bit of a disaster internally even if 2-4% seems like a small number. We hate that this would even happen, and I’m not saying it’s DataStore2’s fault–I’m just looking for help as to how this could’ve happened and a potential solution.
I’m not sure if this is true, but it seems like Roblox implemented a new system that allocates more resources to larger, more demanding servers. However, if this is true, it also means that smaller, less-populated servers are understandably getting less resources.
I’m pretty convinced this is why DataStore2 is failing to save my data, but I could be wrong.
Being like many and really not enjoying working on datastores, I’m hoping it could be something with the version I’m using or the way I used DataStore2. I first was using the Roblox model, but now I’m using the latest release version provided on GitHub.
Here’s an example of how I’m using DataStore2. It’s not exactly the same as the code I’m using, but it is quite literally exactly the same method of how I’m using it:
Click to show code
local rs = game:GetService("ReplicatedStorage")
local DataStore2 = require(game:GetService("ServerScriptService").DataStore2)
local SendMoneyEvent = rs.SendMoney
local SendWeaponsEvent = rs.SendWeapons
local PurchaseRequest = rs.PurchaseRequest
local PaintWeapon = rs.PaintWeapon
DataStore2.Combine("MainData", "UserWallet", "UserWeapons")
game:GetService("Players").PlayerAdded:Connect(function(player)
local userWallet = DataStore2("UserWallet", player)
local userWeapons = DataStore2("UserWeapons", player)
local function sendUserMoney(value)
SendMoneyEvent:FireClient(player, value)
end
sendUserMoney(userWallet:Get(5000))
userWallet:OnUpdate(sendUserMoney)
local function sendUserWeapons(value)
SendWeaponsEvent:FireClient(player, value)
end
sendUserWeapons(userWeapons:Get({}))
userWeapons:OnUpdate(sendUserWeapons)
end)
-- An example of how data would change, for example, when purchasing a weapon:
function PurchaseRequest.OnServerInvoke(player, requestData)
if requestData.WeaponID then
-- Just pretend I check they have enough money here lol, the point is the userWeapons store
local userWeapons = DataStore2("UserWeapons", player)
local currentGuns = userWeapons:Get({})
currentGuns[requestData.WeaponID] = {Skin = "Epic", Effect = "Sparkle"}
userWeapons:Set(currentGuns)
end
end
-- And when editing some stats of that weapon:
function PaintWeapon.OnServerInvoke(player, requestData)
if requestData.PaintColor and requestData.WeaponID then
-- Pretend there's other checks here too like if the player owns the gun they're trying to paint
local userWeapons = DataStore2("UserWeapons", player)
local currentGuns = userWeapons:Get({})
currentGuns[requestData.WeaponID].Skin = requestData.PaintColor
userWeapons:Set(currentGuns)
end
end
tl;dr: DataStore2 is causing a ton of data loss for me. Is it my improper programming, is it Roblox slowing down lower-end servers, or is it DataStore2 (like a bad version or something? I doubt this last one)?
Thanks in advance for any assistance.