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

Http requests are handled differently in client than in studio?

Asked by 6 years ago
Edited 6 years ago

I have a game track api thing, and I see that ONLY when I am in client / test mode, i get the error Can't decode JSON, which is cause by the data to be received differently.

Code:

function SetupGameBoards(p)
    local games = Helpers:Sort(require(workspace.GameManager):GetPlacesByUser(p.UserId,p))
    if games == nil or games[1] == nil then
        game.ReplicatedStorage.MakeChat:FireClient(p,"An HTTP error caused your data to fail. The game will automatically retry in 5 seconds.",BrickColor.Red().Color)
        game.HttpService:GetAsync('http://proxification.info/browse.php')
        print("! DATA FAIL !")
        wait(5)
        SetupGameBoards(p)
    end
    local count = 1
    while games == nil do
        if count > 5 then
            warn("Can not load games right now")
            break
        end
        warn("Games for " .. p.Name .. " failed to load! Retrying. . .")
        count = count + 1
        wait(5)
    end
    local folder = Instance.new("Folder", workspace.Trackers)
    folder.Name = p.Name
    local row = 1
    for i=1,#games do
        --if _G:loadData(p,games[i]["PlaceID"] .. "_extended") == false then
            local board = game.Lighting.Template:Clone()
            local plays = games[i]["Plays"]
            if plays >= 500 then
                board = game.Lighting.Template:Clone()
            elseif plays >= 300 then
                board = game.Lighting.TemplateMedium:Clone()
            elseif plays >= 100 then
                board = game.Lighting.TemplateSmall:Clone()
            else
                board = game.Lighting.TemplateSuperSmall:Clone()
            end
            if games[i]["PlaceID"] == game.PlaceId then
                board.Main.BrickColor = BrickColor.new("New Yeller")
                board.Thumbnail.BrickColor = BrickColor.new("New Yeller")
                print("showin ma self!")
            end
            board.Parent = folder
            board.Plays.Value = games[i]["Plays"]
            board.PlaceId.Value = games[i]["PlaceID"] -- This line must come last
            board:MoveTo(workspace.MarkersL:FindFirstChild("Row" .. tostring(row)):FindFirstChild(tostring(column)).Position)
        --[[elseif _G:loadData(p,games[i]["PlaceID"]) == true then
            local board = game.Lighting.TemplateExtended:Clone()
            board.Parent = folder
            board.Likes.Value = games[i]["TotalUpVotes"]
            board.Dislikes.Value = games[i]["TotalDownVotes"]
            board.Favorites.Value = games[i]["Favorites"]
            board.Online.Value = games[i]["PlayerCount"]
            board.isFilteringEnabled.Value = games[i]["IsSecure"] or games[i]["ShowExperimentalMode"]       
            board.Plays.Value = games[i]["Plays"]
            board.PlaceId.Value = games[i]["PlaceID"] -- This line must come last
            board:MoveTo(workspace.MarkersL:FindFirstChild("Row" .. tostring(row)):FindFirstChild(tostring(column)).Position)
        --end--]]   
        row = row + 1
        if row > 16 then
            break
        end
        wait(0.1)
    end
    for i=1,#games do
        p.leaderstats["Total Plays"].Value = p.leaderstats["Total Plays"].Value + games[i]["Plays"]
    end
    column = column + 1
end

It uses a site called proxification, and is acting weird in client mode. Thank you for the help.

Answer this question