Hello there! I’m working on some game which is based on players’ interaction between each other and want to make something like this:
This is from a game called “Adopt Me!”. So basically it shows if player plays this game right now or no. I tried to search some articles about it up, but didn’t find anything about it. Maybe there are something that allows check is player playing right now or no, whatever server they are it.
If you know something about it, please, leave some sources in reply. Have an awesome day!
You could set a datastore on roblox with all the players that are currently online and look for them (request limits might make that a very bad option)
Another way would be using your own dedicated server to host your own database storing all of the online players and (web)server sided code to sort it all and retrieve the players friendlist online status with a single httprequest (optimal way of doing this imo)
And a third way that im not so sure about is sending a request to the roblox api (using a middle server because you cant send an api request to roblox using roblox studio) to check who on the player friendlist is online and what game theyre playing (it wont work for some cases because of privacy settings)
Edit:
Another way I just remembered is using this
This service will allow you to communicate with all of the servers of your game
There is in fact a way to do this with the lua api I think. I did just just look this up but here we go:
You can use a thing called GetPlayerPlaceInstanceAsync which returns in the player is currently in the games server list. Check out the example code on the api page.
This would probably be the best way to go about doing this (if you don’t already have a dedicated server for your game for other uses)
So just ignore my comment
I mean yeah this way means that you dont get to see if a player is “online” on roblox. I guess you could change the wording to make it say “not on the game” and “on the game”
Player | Roblox Creator Documentation returns a table containing both the place and game (sometimes referred to as job ID) IDs. this allows you to teleport a player directly into the same server