So I have a game where it picks a random number from 1 to 1,000,000,000 and sends the player to that place's ID if it exists. The game works fine, but I was wondering if there was a way to tell if the place has at least 100 visits. This is so that we don't keep on getting sent to starter places.
COMMUNITY QUESTION
How to get the visit count of a place by ID?
1 answer
here is a little function for finding a few stuff from the game page.
function players_online(place_id)
local web = game.HttpService:GetAsync("https://www.rprxy.xyz/games/"..place_id)
local player_text = string.find(web,"Created") -- ("Visits", "Favorites", "Playing", "Created", "Updated") find the online players section
local new = string.sub(web,player_text)
local number_start = string.find(new,">") -- find where the number starts
new = string.sub(new,number_start)
local number_end = string.find(new,"<") -- find where the number ends
new = string.sub(new,2,number_end-1)
local players_online = string.gsub(new,",","") -- in case it's over 1000 players
return players_online
end
print(players_online(2180488865))
This discussion is preserved as it was. New answers, comments, and votes are closed.
