How do I get my game's place visits?

So, I was wondering if anybody knew how to get game place visits via script using httpservice. I have been wondering about this for quite a while. In my admin GUI, I want it to show all of the visits the current game has and much more game data. All help would be appreciated, thanks!

2 Likes

You could use the roblox games api. But you’d have to create a proxy as you can’t access roblox api from roblox studio.

1 Like

You can use

local HttpService = game:GetService("HttpService");

local Response = HttpService:RequestAsync({
    Method = "GET";
    Url = string.format("https://games.rprxy.xyz/v1/games?universeIds=%d", game.GameId); --// Send to the rprxy.xyz proxy with the current game's id
});

if (Response.Success and Response.Body) then --// If it succeeded, returned a status code of 200-299, and gave a Body
    local Body = HttpService:JSONDecode(Response.Body) --// Turn the JSON string into a Lua table

    if (Body.data[1]) then --// If we got data for our game
        local Visits = Body.data[1].visits;

        --// Do what you need to
    end
end

I got that here.

Oops, Wrong link --fixed

5 Likes

Thanks, it worked! :β€ŒDβ€Œβ€Œβ€Œβ€Œβ€Œβ€Œβ€Œβ€Œβ€Œβ€Œβ€Œβ€Œβ€Œβ€Œβ€Œβ€Œβ€Œβ€Œβ€Œβ€Œβ€Œβ€Œβ€Œβ€Œβ€Œβ€Œβ€Œβ€Œβ€Œ

No problem, glad I could help :slight_smile:

what exactly does the β€œvisits” string return? is it the number of visits?
and if i wanted to display the visits on a textlabel, how would i do so?!

It returns visits. If you want to show it on TextLabel, you can use this code.

local textlabel = script.Parent --example

textlabel.Text = visits -- it's the visit.