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

0

turn on api services in settings.

0

alreaddy on

0

You should load the data only if Succsess

0

^ might not help, but its a good practice

0

did nothing...

0

Go to robox studios and enable HTTP services

0

its most likely because you are in team create (pls upvote if that helped)

0

i have

0

also you don't need http service on

0

face palm, i didn't, api was but not https requests. Thanks.

0

but its still not working...

0

Yes we are in team create, so is it just for him, is he just stuck with it?

0

you dont need https service on and in team create things break with datastores but theres nothing you can do

0

just test in-game instead of in studio or you can do if not(game:GetService("RunService"):IsStudio()) then --do datastore stuff

0

ok

0

still not working, its not working for everyone but me, even if they are not in team create!

0

fixed