With the friends updates noted here: Updating Friends API & Deprecating IsOnline property from GetFriendsAsync
I understand that we can get online friends easily and with quite a bit of information to work with… but with the soon-to-be deprecation of GetFriendsAsync, how can we get a list of OFFLINE friends? I can’t seem to find any documentation about this, and other forum posts are old and just say to use GetFriendsAsync…
I’d like to do this specifically for server-sided requests… and GetFriendsOnline doesn’t seem to work for that.
You’ll need to use both, and here’s how:
- Store the list of friends returned by
GetFriendsAsync
in a table
- Store the list of online friends returned by
GetFriendsOnline
in another table
- Iterate over the first table, and check if each friend is found inside of the online friends table, and if so, remove them
- The first table will now only contain friends which are offline
Is GetFriendsAsync not going to be completely useless once the friends update is actually rolled out, since it can only store 200 friends?
Also, any idea how i can get this info in a server script without sending a table with 800 friends on it via remote events? I’m pretty sure GetFriendsOnline can only be used locally.
I checked the announcement and the docs article for GetFriendsAsync, and it doesn’t seem to be (or is going to be) restricted to 200 friends. What will be limited to returning the top 200 friends is the GetAllFriends endpoint of the Friends API, which should be separate from GetFriendsAsync
RemoteEvents/RemoteFunctions/UnreliableRemoteEvents are required for sending data from the client to the server (or vice-versa)
As far as I know, GetFriendsAsync and GetFriendsOnline should work on the server-side, but it’s been a while since I’ve used it, so I need to check to make sure
@AerostyleDev
I’ve just checked: GetFriendsAsync is able to be used on the server-side, but GetFriendsOnline needs to be used on the client-side (as you correctly stated)
@AerostyleDev
If you don’t require any of the data returned by GetFriendsOnline, you could send a buffer containing only the user IDs of the online friends, although it’s a bit risky since the client will be the one creating and sending the buffer to the server. An exploiter could tamper with the buffer’s data so that the server encounters an error when it tries to read its information
I’m currently trying to find ways around sending data too often. My ultimate goal is to use the friend information in conjunction with messaging service to have a player’s in-game friend list update dynamically, as friends enter and leave the game (and other games). It worked just fine before because i used .IsOnline from GetFriendsAsync. Now, i’ll likely run :GetFriendsOnline way more often and do things on the client more often generally… which is unfortunate because i really don’t need all that data. ill probably post my server side code here after i’m done.
1 Like
It’s unfortunate when something that was convenient is removed or deprecated, and you’re right to be concerned about frequently sending large amounts of data
Currently, handling this on the client-side seems to be the best option, but do remember to check data on the server-side if it needs to be replicated to other players