I’ve been trying to get my game’s place visits through a script but I couldn’t find a way how to. In a admin panel for a game I’m making, I want it to display the visits the game has but I couldn’t find a way to script that, any help is appreciated!
2 Likes
Here is an example script. This requires a universeId. Go here to find it:
https://api.roblox.com/universes/get-universe-containing-place?placeid=5773630585
– replace 5773630585 with your place id
You’ll get the following:
{“UniverseId”:2048167896}
Copy and paste those numbers to the corresponding script below.
local HTTP = game:GetService("HttpService")
local universeId = 2048167896
local gameRequest = "https://games.roproxy.com/v1/games?universeIds="..universeId
local success2, result2 = pcall(function()
return HTTP:GetAsync(gameRequest)
end)
if success2 then
local Visits = HTTP:JSONDecode(result2).data[1].visits
print(Visits)
end
Output:
Keep in mind you could just request your UniverseId in game with HTTP, but because it’s static it’s just taking up resources. Better to have it in a variable there.
3 Likes