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.

17 comments
turn on api services in settings.
alreaddy on
You should load the data only if Succsess
^ might not help, but its a good practice
did nothing...
Go to robox studios and enable HTTP services
its most likely because you are in team create (pls upvote if that helped)
i have
also you don't need http service on
face palm, i didn't, api was but not https requests. Thanks.
but its still not working...
Yes we are in team create, so is it just for him, is he just stuck with it?
you dont need https service on and in team create things break with datastores but theres nothing you can do
just test in-game instead of in studio or you can do if not(game:GetService("RunService"):IsStudio()) then --do datastore stuff
ok
still not working, its not working for everyone but me, even if they are not in team create!
fixed