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

Does anyone know how to fix "Request was throttled" ?

Asked by 6 years ago
Edited 6 years ago

My saving script isn't working because of the error "Request was throttled. Try sending fewer requests" Can someone please fix my code?

local DataStore = game:GetService('DataStoreService')
local ds1 = DataStore:GetDataStore("CoinsSystemededsed")

function joining(player)
    local leader = Instance.new("Folder",player)
    leader.Name = 'leaderstats'
    coins = Instance.new("IntValue",leader)
    coins.Name = "Coins"
    local check = ds1:GetAsync(player.UserId)
    if check == nil then
    coins.Value = 0
    ds1:SetAsync(player.UserId, coins.Value)
    elseif check == not nil then
    coins.Value = check
    end
end

function leaving(player)
    ds1:SetAsync(player.UserId, coins.Value)
end

game.Players.PlayerAdded:connect(joining)
game.Players.PlayerRemoving:connect(leaving)

2 answers

Log in to vote
0
Answered by
Tomstah 401 Moderation Voter
6 years ago

"Request was throttled" means that ROBLOX is manually controlling how many signals you're sending because it's too much. There's a limitation for each Datastore function per minute along with a limitation on how many times you can write to the same key. The latter of the two is the one affecting you. As you can see in this image, there's a 6 second wait time before writing on the same key.

0
Do you think I should add debounce or wait to the script? ( I'm a beginner when it comes to saving.) This is the only script I have running Async. There isn't auto save and it doesn't save whenever the value changes. I'm sorry, i'm just still not clear on what I should add or change exactly. iiGamer_Master 1 — 6y
Ad
Log in to vote
-1
Answered by 6 years ago

Do you have your Studio API enabled in the place settings? Usually that'd return a different error, but I'm not entirely sure here. I mean, it's a pretty straight forward. But i can see an error, you using the 'or' operator without an if statement. That's not how setting variables work. You can't tell it 'or' something else without giving it an argument.

0
I have the API enabled and I fixed the code I will repost it above, however it still doesn't work. iiGamer_Master 1 — 6y
0
Infinite look up the Lua ternary operator. cabbler 1942 — 6y

Answer this question