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)

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