Data is being lost... Wanna help find out why?

I’d love it if anyone could figure out why I am loosing data in Farming with Friends…

I’ll totally work out a reward/payment if you go through a bunch of trouble to fix it. Obviously you’d have to convince me you actually fixed it before I paid you but I’m willing to give at least a few thousand Robux for a solid fix.

Basically what is going wrong is that you didn’t protected your DataStorage functions. Datacalls can fail, that is why it is common pratice to include a pcall() around them, so that you can be sure that the data has been correctly saved.

This has to do with the fact that the ROBLOX servers are queing the request, since they were overloaded for that time period

Does the Player still has his/her data from older sessions ? It should have this data, else something did go wrong with updating our key, causing the data to be corrupted. If Players can still get there older sessions back, then we can easily patch your current method.

Q : Can you fix the fact that ROBLOX servers are overloaded.
A : Kind of. I got a cache in my own DataStore module that will just bug the ROBLOX servers until the Data has been succesfully saved.

function savePlayerData( Player )
        if( Player and CurrentPlayerData[ Player.userId ] )then
                RegionDataStore:SetAsync( "INFO_" .. Player.userId, CurrentPlayerData[ Player.userId ] )
        end
end

Change that snippet of code, and wrap it inside a pcall… Also when you get a DataStore, wrap it inside a pcall() or actually check in your code or this won’t be nil

local RegionDataStore = game:GetService("DataStoreService"):GetDataStore("RegionStorage")

Saves are completely erased when issues occur. I haven’t gotten errors but the callsay prevent the errors from reaching the google analytics. I’ll use your suggestions. I wish there was an easy way to see if it fixed it.

Pretty sure I figured it out…

If the repeated character happened to have been a bracket it would have broken the JSON decoder ._.

Nice, another error was keeping that one from even happening ._.

When I was playing the game I came back next day and found everything I had done, gone. I was pretty upset by that and just didn’t play any more sadly. Good luck fixing it tho

I already fixed it. The issue was due to myself saving too much data in a single datastore key. The issue only effected those with large enough farms. It’s all fixed if you want to come back <3

Note that your SaveRegion function will eventually fail since multiple calls to SetAsync are not atomic, if it fails halfway through, it’ll plainly corrupt the JSON (and yes, it does happen, but rarely). I use revisions to prevent this issue, every “chunk” of data gets another identifier which increases by one each save. At the end of the save, it’ll update some “root” data with the newest revision id if all SetAsyncs went through properly. If it fails at some SetAsync it’ll not update that number and thus fall back to the latest working revision.

I would suggest allowing data to load normally, but divide the tables into sub tables, then send them via DataStores so they all do not fail. Or, you can make your own parser.

Here I am!

Here I am!

If you get to the point of a custom parser, basically the existing one runs on converting it to a string, then decoding is subbing each letter, if it matches one, it goes to a function and stays in the function until it finds the end. (I think I should make one some day)

A good thing to do is to pcall it, and if it fails, wait a few seconds and try again, and keep going until it works (or it gets to try like 10).

It pains me how uncompressed the data is. “],[” is so common in the string and just using a separate character instead of those three would noticeably cut down on data size. I feel like if I do make any changes, I’ll just compress the JSON down.

Reminds me of a tech forum that I continually got my email spammed by because whenever mentioned you in a post via @username, you got an email. My username was “Echo”, and that site just happened to have a lot of bat scripts posted. One of the snippets of code you’ll frequently find in bat scripts is “@echo off” – my inbox was not amused.

Protip: Do not use JSON

On topic: How do you save data? Do you store items in names, ids? This may be a case of figuring out optimizations to save in 1 key.

Protip: Do not use JSON

On topic: How do you save data? Do you store items in names, ids? This may be a case of figuring out optimizations to save in 1 key.[/quote]

Do not use JSON has to be the least helpful sentence I’ve heard mainly because you didn’t say why or any alternatives.

The tweet in OP has a link to a paste in with the entire farm plot saving script.

“Data is being lost… Wanna help find out why?”

I can’t stare this post with a serious face. :stuck_out_tongue: :DDD

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.