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

Datastore not working? (Request was throttled. Try sending fewer requests)

Asked by 6 years ago

I am trying to make a datastore system for a game, but the Throttled Request warning keeps appearing, and I'm only sending one request. This is the script:

local datastore = game:GetService("DataStoreService")
local ds = datastore:GetDataStore("CashSaveSystem")

game.Players.PlayerAdded:connect(function(plr)
    local leaderstats = Instance.new("Folder")
    leaderstats.Parent = plr
    leaderstats.Name = "leaderstats"
    local cash = Instance.new("IntValue")
    cash.Parent = leaderstats
    cash.Name = "Cash"

    ds:SetAsync(plr.UserId, cash.Value)
    cash.Value = ds:GetAsync(plr.UserId) or 1000
    ds:SetAsync(plr.UserId, cash.Value)
    wait(1)
    cash.Changed:connect(function()
        ds:SetAsync(plr.UserId, cash.Value)
    end)

end)
0
` cash.Changed` is most likely your problem. Change it to once every 5 or 10 mins and when the player leaves the game. MooMooThalahlah 421 — 6y
0
i use that all the time if the message is in orange it will just save a second after sturdy2004 110 — 6y
0
I'd set up an autosave function every 5 minutes or so instead of every time your cash value changes. 90% sure that is your problem. Crazycat4360 115 — 6y
0
Clearly you all were not reading the question. I only sent one request, and it gave me the Request Throttled message. VeryWowMuchDoge 47 — 6y
View all comments (2 more)
0
for every request i made, it gave me that message. VeryWowMuchDoge 47 — 6y
0
and like it says in the question, the DataStore just isn't working. It isn't saving or loading anything. VeryWowMuchDoge 47 — 6y

Answer this question