Any way to tell if a player adds another player (server-sided)

I want to use Player:IsFriendsWith() in a regular script, but according to the devhub page, it caches

Is there a way to tell if a player friends another player server-sided?

The “PlayerFriendedEvent” only works on the local player apparently

The best solution would be to handle PlayerFriendedEvent on the client and fire a RemoteEvent, which you could then optionally verify with IsFriendsWith on the server.

But if you want to guarantee that two players are friends on the server, I have looked across the API and found some alternatives:

  • Player:GetFriendsOnline() - 30 second cache (API reference)
  • Players:GetFriendsAsync(UserId) - unspecified (API reference)
  • SocialService:CanSendGameInviteAsync(Player, RecipientId) - unspecified (API reference)
  • Web API: https://friends.roblox.com/v1/users/USER_ID/friends?userSort=0 (Docs)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.