Is this too much to DataStore2? (so many uses per second)

Hi, players in my game are experiencing dataloss so hard, so I was thinking if this is too much.
Gif is not accelerated!

https://gyazo.com/7711bc48996cc5e282fa2842e4098fa9

so every time you touch a coin this happen:

BackpackStorage:Increment(val)

so I can imagine that ds2 is working hard in my game, maybe this can cause the dataloss

2 Likes

Yes. If not because it’s causing problems then because it’s improper. Even singleplayer games only autosave like every five minutes or when you buy something, and this is using the network.

2 Likes

Hi! So what you recomend? Thanks for your time

Never mind, I didn’t realize DataStore2 was a module. You’d need to ask someone else to see how often it actually saves as I can’t be bothered to read the source.

1 Like

Oh wow, that’s a TON of requests. I’d say save it every 1 minute or so as it doesn’t seem hard to get these coins at all.

1 Like

If you’re making a request every time you get a coin, then that’s far too many requests and would cause everyone’s data to throttle.

1 Like

Forget throttling, it would drop all the requests within seconds.

1 Like

Hi, so you think this may cause troubles? I have the entire game with ds2, should I quit this Increment() function out and save the coins apart of the rest of the game?

Yes, that’s exactly what you should do. Make an autosave in the playeradded for 60 seconds between intervals.

1 Like

Alright I bothered a little. Increment doesn’t directly cause a save. I don’t think this is causing your problem.

2 Likes

Yes, almost all the saves are Increment, I don’t abuse Set(), so that confuses me

The entire DataStore2 Module is entirely dependent on whenever data changes, it’ll automatically update to that value. (Sorta acts like a Changed function.) So unless the OP knows in-depth of what the Module is accomplishing and is able to restructure it for his own being, I’m not sure how this would be approached.

1 Like

his increment is just

function DataStore:Increment(value, defaultValue)
	self:Set(self:Get(defaultValue) + value)
end

based on this I would say no

3 Likes

I recommend you to save data when the player leaves.

Make sure to save data when they accidentally disconnect, I think there’s videos for that.

1 Like

I would like to tell some people that he is using DataStore2 module, which automatically saves all your data when player is leaving and on BindToClose.

All you need to do is just update the value everytime, Datastore2’s Increment method I believe doesn’t call Datastore directly on this method.

If players have been facing dataloss even after implementing Datastore2 its most likely not been implemented properly. Therefore I would recommend reading how the DataStore2 module actually works.

https://kampfkarren.github.io/Roblox/