Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

(solved )leader stats broken? error 502: API Services rejected request with error. HTTP 0 (HTTP 403)

Asked by 5 years ago
Edited 5 years ago

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.

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

Answer this question