I keep getting the error 502: API Services rejected request with error. HTTP 0 (HTTP 403) This happens on my leader boards and leader stats. I happens when using :GetAsync(key)
error is in pcall function.
Leader boards script:
local CashODS = game:GetService("DataStoreService"):GetOrderedDataStore("CashODS") local function Handler() local Success, Err = pcall(function() local Data = CashODS:GetSortedAsync(false, 5) local CashPage = Data:GetCurrentPage() for Rank, Data in ipairs(CashPage) do if Rank < 100 then local Name = Data.key local Cash = Data.value local NewObj = script.Parent.MainScrollingFrame.Example:Clone() NewObj.Visible = true NewObj.Name = "FrameForLeaderBoard" NewObj.PlayerName.Text = Name NewObj.MoneyName.Text = Cash NewObj.RankName.Text = "#"..Rank NewObj.Position = UDim2.new(0, 0, NewObj.Position.Y.Scale + ((0.05 * #script.Parent.MainScrollingFrame:GetChildren())-0.05), 0) NewObj.Parent = script.Parent.MainScrollingFrame end end end) if not Success then error(Err) end end while true do for _,Player in pairs(game.Players:GetPlayers()) do CashODS:SetAsync(Player.Name, Player.leaderstats.Money.Value) end for _,v in pairs(script.Parent.MainScrollingFrame:GetChildren()) do if v.Name ~= "Example" then v:Destroy() end end Handler() wait(60) end
leader stats script (error is second last line):
local Ds = game:GetService("DataStoreService") game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" local DonutsEaten = Instance.new("IntValue", leaderstats) DonutsEaten.Name = "Donuts Eaten" local Money = Instance.new("IntValue", leaderstats) Money.Name = "Money" Money.Value = 0 local MoneyDs = Ds:GetDataStore("Money") Money.Value = MoneyDs:GetAsync(player.UserId) or 0 MoneyDs:SetAsync(player.UserId, Money.Value)
This error only happens for my friend, we have tried real servers, i have leader stats but his are nil.