Seeing the players in a place within a universe

I am attempting to create a system which will show you the amount of players in a place, within a universe. What I am trying to do is create a GUI. for visualization, so players can see the amount of players in each minigame. I’ve seen ways to do this by using a server or by getting the universeId, however I couldn’t figure it out. What i’ve seen is using a proxy like https://rprxy.xyz/, and I have tried it, although I do not know how to utilize it. However I do not know where to begin. Any suggestions of help? Thanks!

1 Like

NOTE: I have found a way, although it isn’t working correctly. There is this output: image

function players_online(place_id)
	local web = game.HttpService:GetAsync("https://www.rprxy.xyz/games/7042977427")
	local player_text = string.find(web,"Playing")
	local new = string.sub(web,player_text)

	local number_start = string.find(new,">")
	new = string.sub(new,number_start)

	local number_end = string.find(new,"<")
	new = string.sub(new,2,number_end-1)

	local players_online = string.gsub(new,",","")
	return tonumber(players_online)
end

print(players_online)
print("script ended")```
1 Like

I would think this is because you are printing the function and not running it

It is now saying that there is a “HttpError: InvalidRedirect” Any way to fix that?

1 Like

I’m not sure, I’m not good with HTTPService, sorry.

1 Like

Alright, thanks for your help anyways.

1 Like

You are using the wrong URL and I think that Id is from a place, not the universe/experience, try this

local ID = 
function players_online(place_id)
	local web = game.HttpService:GetAsync("https://games.rprxy.xyz/v1/games?universeIds=" .. ID)
	local data = game.HttpService:JSONDecode(web).data[1]
	local Playing = data.playing
	return tonumber(Playing)
end

print(players_online())
print("script ended")

Go to the game settings and find your game, then click on “configure experience” and, in the link that will open, copy the numbers and paste them on the first line.

PS: use pcall as it sometimes crashes.

1 Like

This script looks very good. The only problem that the output is giving me the “HTTP 429 (Too Many Requests)” Would adding a wait() help?

That error is not because of the script, as it says, it means that it could not be done because there are too many requests and, I think, this is because Roblox itself asks for that data, that’s what the pcall is for

local ID = 
function players_online(place_id)
	return pcall(function()
		local web = game.HttpService:GetAsync("https://games.rprxy.xyz/v1/games?universeIds=" .. ID)
		local data = game.HttpService:JSONDecode(web)
		return data.data[1].playing
	end)
end

local Success, playing = players_online()
if Success then
	print(playing)
else
	print("Error found")
end

You could make a text that says “An error has occurred, retrying on …” and try a few seconds later.

I am configuring it, although it is only responding with a 0 player count. I’m going to look into it further.

1 Like