Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

is there a way to show the amount of players in another game?

Asked by
Talveka 31
4 years ago

hello! i've been working on a game that is essentially a lobby that teleports to other games.

now, these games could be anything. so i was wondering; is there a way to see the amount of players in another game?

i feel like this would be helpful for a player who wants to know if the game he's going to even has any players. help would be appreciated!

0
Contact me on discord : Vitrox#0329 VitroxVox 884 — 4y

2 answers

Log in to vote
0
Answered by
VitroxVox 884 Moderation Voter
4 years ago

Hello well I searched for method's but the only method I've found was if you're making a game like "Main game" then the servers in that or i mean like a GUI you can maybe count the players joining / leaving it? Well the joining i get but leaving not sure, maybe a datastore to update the player count and get it thru there? Try a datastore. I've never seen this question before and I'm curios for the answer as well.

0
hmm.. wouldn't a table suffice? even if i tried this, im trying to see a main game's player count through a main game so, it wouldnt work really lol Talveka 31 — 4y
0
So you're trying to get the current games playercount or? VitroxVox 884 — 4y
0
Oh wait i get what you mean, I'll look into it a second. VitroxVox 884 — 4y
0
Why don't you just use apis? Tweakified 117 — 4y
0
Well you can it's just that you can't use ROBLOX's API without using a proxy. VitroxVox 884 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Hello,

You can do this very easily with the HttpService using a webapi

The games api does this perfectly.

To do this ingame, you could do something like:

local HttpService = game:GetService("HttpService")
local universeId = 445 -- change to your own place universe id

local response
pcall(function()
    response = HttpService:GetAsync("https://games.rprxy.xyz/v1/games?universeIds=".. universeId)
end)

if response ~= nil then
    local data = HttpService:JSONDecode(response)
    local playing = data["data"][1]["playing"]
    print(playing)
end

You have to use a roblox proxy because otherwise, you will get a "Trust check failed" error

A universeId is not a placeId. There is a distinct difference. A placeId is the id for the entire game, as you can have multiple places inside one game. A universeId is the id for a place inside the game.

Tonge twister, I know.

You can get these universeIds with another api service: https://api.roblox.com/Marketplace/ProductInfo?assetId=<placeId>

Anyway, hope this helps,

If it does, please press the Accept Answer button, Tweakified

Answer this question