So, I don't really have much besides some code that I tried to find, but I'm trying to find the total number of players in the game using the PlaceID..
I don't know what to use, besides these codes.
local gameid = 970631874 local NumPlayers = #game.Players:GetPlayers();
For the #game, how would I correlate that to the gameID instead of the server game?
My explanation is really bad, but I have a lobby. And from there, I'm going to have 4 different teleporters that will teleport to different places. I was wondering if I could get the total amount of people playing that exact game.
-- inside the brick where it finds all the players
while true do wait(0.2) if game.Players.NumPlayers == 1 then --instead of the server that it is in, how to make it a specific PlaceID? script.Parent.Text = "There is " ..game.Players.NumPlayers.. " player online" else script.Parent.Text = "There are " ..game.Players.NumPlayers.. " players online" end end
-- serverside
game.Player.PlayerAdded:connect(function() game:GetService("DataStoreService"):GetDataStore("Plrs"):IncrementAsync("Players",1) end) game.Player.PlayerRemoving:connect(function() game:GetService("DataStoreService"):GetDataStore("Plrs"):IncrementAsync("Players",-1) end)
Hopefully these codes will help to make a solution.
Thanks,
LukeGabrieI aka EnergyBrickz
I'm pretty sure this isn't in ROBLOX's API. You'd need to use HTTP service and scrape the page with your place id, parse the page, find the div that shows the players playing (if that even shows on attached games), then return the number. If anyone has another idea, I'll delete this~