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

Hello, I want to make it so on my portal, there is a sign that shows how many players are in a place. This means if a place has 5 players, then the sign would say 5 players. How do I do this?!?!?! I have some code here.

local sign = script.Parent
local HttpService = game:GetService("HttpService")

local QUERY_URL = "https://www.roblox.com/games/8036081158/Blaster-Battle"
local GAME_ID = game.GameId

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

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

print(playersInGame) -- 0
while true do
	sign.Text = "Players:" + playersInGame
end

The variable “sign” is a TextLabel.
Error is Trust Check Failed.
Please help!!!
PLEASEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE!

Its because roblox games cant access any roblox related sites. You have to use a site like roproxy.com. You just have to replace roblox.com with roproxy.com. Just do this.


local QUERY_URL = "https://www.roproxy.com/games/8036081158/Blaster-Battle"

1 Like

Site can’t be reached.

charssssss

Also, some errors with the code, keep in mind, this is written on mobile so there may be some issues


local sign = script.Parent
local HttpService = game:GetService("HttpService")

local QUERY_URL = "https://www.roproxy.com/games/8036081158/Blaster-Battle"
local GAME_ID = game.GameId

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

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

print(playersInGame) -- 0
while true do
	sign.Text = "Players: " .. playersInGame
task.wait(1)
end

Just fixed up the code a bit

1 Like

Can you please say which line this happens on?

1 Like

I apologize. I went here.

When I run, I recieve
Http Error: DnsResolve

Ahh, i see why. You gotta use the roblox api. Also make sure http requests are enabled.
Heres the api for games. If u have any questions then ask me

https://games.roblox.com/docs#!/v1

Nvm, just use this code, dont edit the query url this time, or it’ll break


local HttpService = game:GetService("HttpService")

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

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

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

print(playersInGame) -- 0

Dont edit anything, only add the while loop i updated for the text. NOTHING else

I gtg, gotta sleep. Thank you so much for your help! I will defininitely follow your advice. I have a stupid question. Do I put the entire thing into the while loop? Or do I put in the sign update thing into the while loop?

Just do this. Since the old code would get the old concurrent players

while true do
local HttpService = game:GetService("HttpService")

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

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

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

print(playersInGame) -- 0
task.wait(5)
end


1 Like

Also, HTTP 410: (RPRXY IS NO LONGER AVAILABLE)

Yeah, i updated the code, rprxy shut down. Just use the code i out above

local Http = game:GetService("HttpService")

while task.wait(5) do
	local URL = "https://games.roproxy.com/v1/games?universeIds=3074028660"
	local Data = Http:GetAsync(URL)
	local DecodedData = Http:JSONDecode(Data)
	local PlayingCount = DecodedData["data"][1]["playing"]
	print(PlayingCount)
end

@Forummer @conra_virusman
I used this code

local Http = game:GetService("HttpService")
local bruh = script.Parent
while true do
	local URL = "https://games.roproxy.com/v1/games?universeIds=3074028660"
	local Data = Http:GetAsync(URL)
	local DecodedData = Http:JSONDecode(Data)
	local PlayingCount = DecodedData["data"][1]["playing"]
	bruh.Text = "Players:" .. PlayingCount
	wait(2)
end

and it instead showed me the amount of players in the whole EXPERIANCE. Blaster Battle is part of my game.

Here, scrape from this instead.

Huh? Should i put that into the link? Also, how do i use a place id instead of universe id? I want the amount of players ONLY in 1 place (all servers)
@conra_virusman @Forummer

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

1 Like

testing it… charsssssssssssssssssssssssssssss

@conra_virusman
Attempted to index nil with “playing”

print("Stupid donkey.")
local Http = game:GetService("HttpService")
local bruh = script.Parent
while true do
	local URL = "https://games.roproxy.com/v1/games?universeIds=8089169472"
	local Data = Http:GetAsync(URL)
	local DecodedData = Http:JSONDecode(Data)
	local PlayingCount = DecodedData["data"][1]["playing"]
	bruh.Text = "Players:" .. PlayingCount
	wait(2)
end

hello?