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)

1 comment
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.