of     1   

Smeers
#228239917Wednesday, November 29, 2017 11:08 PM GMT

local function autosave() while true do wait(60) for i,v in ipairs(game.Players:GetChildren()) do setData(v) -- saves player sessiondata to datastore using SetAsync end end end spawn(autosave) -- Basically the title. I'm a bit lost on how to do it without overflowing everything, unless this won't and I'm too scared to try it on a test server
LuaDesign
#228240089Wednesday, November 29, 2017 11:12 PM GMT

You should add a wait inside of the i,v but otherwise es good man. If I had a penny for every penny I had... Mother of god.
Smeers
#228240528Wednesday, November 29, 2017 11:23 PM GMT

Of how long, exactly? Is there specific documentation on how many requests a data store will error at?
turtleman4real
#228241308Wednesday, November 29, 2017 11:42 PM GMT

Datastore throttling occurs when you request (GetAync) a datastore key repeatedl, to attempt to avoid it I recommend caching the data in a table. local Cached = {} local datastore = game:GetService("DataStoreService"):GetDataStore("GameData") function Save(key, data) datastore:SetAsync(key, data) for i,v in pairs(Cached) do if v.Key == key then v.Data = data return end end table.insert(Cached, {Key = key, Data = data} end function Get(key) for i,v in pairs(Cached) do if v.Key == key then return v.Data end end return ####################### end ~turtleman4real
Smeers
#228242172Thursday, November 30, 2017 12:03 AM GMT

I'm technically already caching it as "sessiondata", aka a array of data that is only loaded and saved when the player leaves or joins. However, I'm trying to add autosave to avoid data issues that could happen with client lag or shutdowns.
chimmihc
#228242593Thursday, November 30, 2017 12:12 AM GMT


    of     1