Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Request was throttled. Try sending fewer requests. Help?

Asked by 5 years ago

When I buy an item in game, I check the dev console to see if the datastore is saving it, and it says this:

"Request was throttled. Try sending fewer requests."

I was reading something up and it said about adding a 6 second "cooldown" to the datastore, but I'm unsure on how to do that.

Here is the datastore script:


local DataStore = game:GetService("DataStoreService") local DS1 = DataStore:GetDataStore("LordBlueSkyData") game.Players.PlayerAdded:Connect(function(player) local stats = Instance.new("Folder", player) stats.Name = "leaderstats" local Coins = Instance.new("IntValue", stats) Coins.Name = "Coins" Coins.Value = DS1:GetAsync(player.userId) or 0 DS1:SetAsync(player.userId, Coins.Value) Coins.Changed:Connect(function() print("Saving Data...") DS1:SetAsync(player.userId, Coins.Value) end) end) game.Players.PlayerRemoving:Connect(function(player) DS1:SetAsync(player.userId, player.leaderstats.Coins.Value) end)

2 answers

Log in to vote
0
Answered by 5 years ago

Nevermind, it works.

I thought it was saving items, but it was actually saving the money which I tested and it works.

Sorry about this

0
It doesn't usually affect the values too much, but it is bad because you could go over the Datastore limits with the set requests. climethestair 1663 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

You got that because you were trying to save a key before it was done it's previous save. To eliminate that, instead of saving the value every time Coins is changed, you could save Coins in a local place that keeps track of it without saving every time it's changed. Then save Coins every 3-5 or so minutes, as well as when the player leaves / when the game closes.

Answer this question