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

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

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

"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.

1 comment

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.

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.

2 comments

0

I have the API enabled and I fixed the code I will repost it above, however it still doesn't work.

0

Infinite look up the Lua ternary operator.

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