Help with checking amount of players in a different place in my game

This post was flagged by the community and is temporarily hidden.

1 Like

This post was flagged by the community and is temporarily hidden.

1 Like

so can i put a place id instead of universe id? also is roproxy broken?

This post was flagged by the community and is temporarily hidden.

1 Like

hhow do i get data from a place then?

This post was flagged by the community and is temporarily hidden.

This post was flagged by the community and is temporarily hidden.

@conra_virusman
Yes, I used the id of this minigame. SpaceWars - Roblox
Code:

local HttpService = game:GetService("HttpService")
local function GetUniverseId(GameId)
	local URL = "https://api.roproxy.com/universes/get-universe-containing-place?placeid=".. GameId
	local Response = HttpService:GetAsync(URL)
	Response = HttpService:JSONDecode(Response).UniverseId
	return Response	
end
local thing = script.Parent
while true do


	local QUERY_URL = "https://games.roproxy.com/v1/games?universeIds="

	local GameId = 8036081158
	GameId = GetUniverseId(GameId)
	print(GameId)
	-- "https://games.rprxy.xyz/v1/games?universeIds=000000"
	local endpointResponse = HttpService:GetAsync(QUERY_URL .. GameId)
	local decodedResponse = HttpService:JSONDecode(endpointResponse)
	local gameData = decodedResponse.data

	local gameInformation = gameData[1]
	local playersInGame = gameInformation.playing

	thing.Text = "Players: " .. playersInGame
	task.wait(5)
end

Still entire experience. :frowning:

This post was flagged by the community and is temporarily hidden.

1 Like

so its still entire experience?

This post was flagged by the community and is temporarily hidden.

This post was flagged by the community and is temporarily hidden.

1 Like
local parent1 = script.Parent
local HttpService = game:GetService("HttpService")
local function GetUniverseId(GameId)
	local URL = "https://api.roproxy.com/universes/get-universe-containing-place?placeid=".. GameId
	local Response = HttpService:GetAsync(URL)
	Response = HttpService:JSONDecode(Response).UniverseId
	return Response	
end
local function GetServers(GameId)


	local response = HttpService:JSONDecode(HttpService:GetAsync("https://games.roproxy.com/v1/games/" .. GameId.."/servers/Public?sortOrder=Asc&limit=100" ))
	return response

end
local function GetPlaying(Servers)
	local Playing = 0
	for i,Server in pairs(Servers) do

		local ServerPlaying = Server[1]["playing"]
		if ServerPlaying then
			print('f')
			Playing += ServerPlaying
		end
	end
	return Playing
end
while true do


	local QUERY_URL = "https://games.roproxy.com/v1/games?universeIds="

	local GameId = 8089169472 -- change to place id

	local Servers = GetServers(GameId)
	GameId = GetUniverseId(GameId)

	if Servers then
		local Playing = GetPlaying(Servers)
		-- "https://games.rprxy.xyz/v1/games?universeIds=000000"


		script.Parent.Text = "Players" .. Playing
	end

	task.wait(5)
end

@conra_virusman
It didn’t work. :sob: attempted to index nil with “playing”

This post was flagged by the community and is temporarily hidden.

ok.

@conra_virusman
same error.
i copied ur code

local HttpService = game:GetService("HttpService")
local function GetUniverseId(GameId)
	local URL = "https://api.roproxy.com/universes/get-universe-containing-place?placeid=".. GameId
	local Response = HttpService:GetAsync(URL)
	Response = HttpService:JSONDecode(Response).UniverseId
	return Response	
end
local function GetServers(GameId)


	local response = HttpService:JSONDecode(HttpService:GetAsync("https://games.roproxy.com/v1/games/" .. GameId.."/servers/Public?sortOrder=Asc&limit=100" ))
	return response

end
local function GetPlaying(Servers)
	local Playing = 0
	for i,Server in pairs(Servers) do

		local ServerPlaying = Server[1]["playing"]
		if ServerPlaying then
			print('f')
			Playing += ServerPlaying
		end
	end
	return Playing
end
while true do


	local QUERY_URL = "https://games.roproxy.com/v1/games?universeIds="

	local GameId = 8089169472 -- change to place id

	local Servers = GetServers(GameId)
	GameId = GetUniverseId(GameId)

	if Servers then
		local Playing = GetPlaying(Servers)
		-- "https://games.rprxy.xyz/v1/games?universeIds=000000"


		print(Playing) -- 0
	end

	task.wait(5)
end

This post was flagged by the community and is temporarily hidden.

1 Like

This post was flagged by the community and is temporarily hidden.

local HttpService = game:GetService("HttpService")
local function GetUniverseId(GameId)
	local URL = "https://api.roproxy.com/universes/get-universe-containing-place?placeid=".. GameId
	local Response = HttpService:GetAsync(URL)
	Response = HttpService:JSONDecode(Response).UniverseId
return Response	
end
local function GetServers(GameId)


		local response = HttpService:JSONDecode(HttpService:GetAsync("https://games.roproxy.com/v1/games/" .. GameId.."/servers/Public?sortOrder=Asc&limit=100" ))
	return response
	
end
local function GetPlaying(Servers)
	local Playing = 0
	for i,Server in pairs(Servers) do
		
		local ServerPlaying = Server[1]["playing"]
		if ServerPlaying then
			print('f')
			Playing += ServerPlaying
		end
	end
	return Playing
end
while true do


	local QUERY_URL = "https://games.roproxy.com/v1/games?universeIds="
	
	local GameId = 8604687396 -- change to place id

	local Servers = GetServers(GameId)
	GameId = GetUniverseId(GameId)

	if Servers then
		local Playing = GetPlaying(Servers)
		-- "https://games.rprxy.xyz/v1/games?universeIds=000000"


		print(Playing) -- 0
	end

	task.wait(5)
end

@conra_virusman is this correct

This post was flagged by the community and is temporarily hidden.

1 Like