How should I work within the 6-second DataStore write limit?

Hello. I want to create a trade system for my game, but nothing I can think of stops potential item duplication. Let’s say I have an autosave system that fires every 10 seconds, as well as saving upon leaving, if the data is modified in any way. Here’s a scenario:

  • Player 1 has item A, Player 2 has item B. B is higher value than A.
  • The autosave happens.
  • Players 1 & 2 complete a trade where they swap items.
  • Player 2 leaves, but because they’ve done this less than 6 seconds after the autosave, the save is queued.
  • Player 2 joins a new server, which loads the data before the trade.
  • Both Player 1 and Player 2 have item B now. If Player 2 does something like earn coins or trade another item to trigger a save, the data will reflect this.

This seems like a reasonable trick to pull off so long as Player 2 has decent Wi-Fi. Is there any way I can write an auto-save that prevents this type of exploit/duplication? A very simple solution on Roblox’s end would either be to bump the UpdateAsync limit to 2 times per second, or get rid of it entirely, but I’m sure there’s a way I can do this now.

I suppose you could sync the loading of the datastore with the system write time, then when the player is just casually loading in, seems not even noticeable that it’s been 6 seconds, and boom no duping. Sorry for just the idea, I haven’t really messed with datastores quite yet and I am looking at this from no-limits perspective, I have no idea if this is possible.

1 Like

My game probably won’t ever take 6 seconds to load, considering it’s a simplistic looking map.

What if you design a loading screen that lasts for about six seconds when the player joins the game?

2 Likes

couldn’t you just bind save to playerremoving?

1 Like

@DavidThatOrdinaryGuy That could work, but I feel like itwould be upsetting to have a 6 second fake loading screen before you can play the game. If this is the best solution I’ll go for it, but it’s not ideal.

@Sniperkaos Only saving upon leaving the game, without some sort of auto save feature, is generally frowned upon, as it can cause bigger problems if it fails.

Okay. Maybe learn how to use ProfileService as an alternative choice, you wouldn’t have to worry about item duplication with that-

1 Like