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