Get Game User Is Playing

Is there a way to get the ID of the game that a user is playing given his/her userId?

4 Likes

Yes. This.

(Not for GameId though, this only contains PlaceId)

2 Likes

I think this will only get the game if the player is within the same universe. I remember having a lot of issues with using this when setting up my lobby place back when a free account could only have one active place.

This is correct. This is the only method I know that actively searches a place for the existence of a player by their UserId. An instance cannot scan outside of its own game for players. The method in Players that checks for friends only displays their online status and TeleportService doesnā€™t have any other similar methods of checking servers for players.

1 Like

Right. The only web endpoint available for this requires you to be logged in (you know, have that ā€œDO NOT SHARE THISā€ cookie?). This endpoint (https://friends.roblox.com/docs#!/Friends/get_v1_my_friendsonline) returns an array of objects structured like this:

1 Like

As well, thatā€™s only available for friends and I donā€™t assume OP wants it for only friends. If they do however, then they will have to use Players::GetFriendsAsync to list friends and their online status, then TeleportService::GetPlayerPlaceInstanceAsync to find the instance and PlaceId in which they are at. These two APIs are enough to make a functional friend following system at a fundamental level.

I can only assume thereā€™s some way to associate a PlaceId with a GameId, but OP isnā€™t specific enough about use case or anything (forgot to ask - @PhoenixSigns, you may need to provide more details to be assisted better).

1 Like

So I asked around a bit and the best way to do is through this API: https://presence.roblox.com/docs

However, as this is a Roblox domain, Iā€™m going to have to set up a proxy server to access it ;-;

2 Likes

hello, i was going through this post, when I saw the presence api you linked! I have one question! What is a UserPresenceRequest? Thank you!