Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Request was throttled. Try sending fewer requests. Help?

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

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

1 comment

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.

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.