The Most Effective Way of Autosaving

I’ve been searching around trying to find the most effective and safe way of autosaving (avoiding the too many requests warning which I’m getting). So far I’ve found this topic but it presents a few ways of going about it:

One of the answers I saw is utilizing this. In post #7 they presented this code:

local saveBlock = {}

local function performWriteRequest(key) -- Example
    if not saveBlock[key] then
        doSomeSaveThing()
        saveBlock[key] = true
        delay(6, function ()
            saveBlock[key] = false
        end)
    end
end

The author noted that they wouldn’t recommend using this code “raw”. Which method do I use? A combination? If I use the function above, what core elements would I change about it? Should I use these methods at all?

FYI: Currently, I autosave a player every minute.

1 Like

There is actually a section on the DevHub for autosaving data. The technique shown there is probably you’re best chance. You can find it here:

1 Like

After reading that section, I might not have everything clear, but I think this is what I’m doing already. Then, I get the too many requests warning. Even though it might not be a problem, I want to make sure that I can have a fully functioning system that players don’t need to worry about. The stuff I found in the post seemed to be what I’m looking for.

1 Like

Couldn’t I just use GetRequestBudgetForRequestType for finding out the server’s request budget?

2 Likes