[Beta] GetFriendsWhoPlayed API: Build Scalable Friend Leaderboards and Social Engagement Loops

Hi Creators,

Friend leaderboards are one of your most requested social features, but today they’re expensive to run at scale because you have to fan out DataStore reads across a user’s entire friend list.

We’re releasing the beta for our new GetFriendsWhoPlayed API that gives you a way to fetch only friends who have actually played your game. Now, you can build fast, reliable friends leaderboards with far fewer reads. We will expand access over time as we validate performance and reliability.

What is the GetFriendsWhoPlayed API?

The GetFriendsWhoPlayed API lets you query friends who have played this universe ever.

Instead of pulling a full friend list and hitting DataStore for everyone, you can now narrow down to the friends who matter and then look up scores only for them. This reduces DataStore load, lowers the chance of rate limits, and makes it more practical to run friends leaderboards at scale.

Implementing a Friends Leaderboard

The beta introduces a new method on Player:

local DataStoreService = game:GetService("DataStoreService")
local GlobalScores = DataStoreService:GetOrderedDataStore("GlobalScores")
local function getFriendLeaderboard(player)
	local friendScores = {}

    -- 1. Fetch friends who played recently
	local friendIds = player:GetFriendsWhoPlayedAsync()

    -- 2. Fetch score of each of the friends who played
	for _, friendId in friendIds do
		local success, score = pcall(function()
			return GlobalScores:GetAsync(tostring(friendId))
		end)
		if success and score then
			table.insert(friendScores, {
				UserId = friendId,
				Score = score,
			})
		end
	end

	return friendScores
end

API shape (beta)

  • Player:GetFriendsWhoPlayedAsync() → Array of userIds (Type: Number)
  • Returns a list of friends’ user IDs who have played the same games.

See documentation here.

Other Use Cases Beyond Leaderboards

Although the main goal is powering friends leaderboards, this API is meant to be broadly useful for any feature that needs “friends who actually play this game,” such as:

  • “Friends who play this game” sections in menus
  • Social surfaces that highlight active friends

What’s Next

In the future, we’re planning to provide out-of-the-box support for friend and global leaderboards on Roblox platform surfaces, designed to drive stronger competition and deeper player engagement.

Please share any feedback with us below. Thank you!

FAQs

Does this replace OrderedDataStore or my existing leaderboard system?

  • No. This API does not store scores or rank players. It helps you figure out which friends to look up; you still own storage, ranking, and display.

Can I use this to build global leaderboards?

  • Not directly. This API is focused on friends who played this universe. Global leaderboards will come later this year

Can I use this outside of leaderboards?

  • Yes. Any feature that benefits from “friends who actually play this game” can use this API.

How should I think about rate limits?

  • Treat “ever played” calls as infrequent bootstraps and rely on “since timestamp” calls for ongoing refreshes. Design your system to cache results and avoid refreshing on every frame or every UI open.

What happens if the API is temporarily unavailable?

  • You should handle failures gracefully (e.g., show cached or partial data, hide the friends tab) and avoid blocking core gameplay on a single API call.
131 Likes

This topic was automatically opened after 10 minutes.

I have played games that take a random user from my friend list and tells me to invite them. Now games will know who has played the game before and now it can be used to guilt trip people into inviting their friends to increase the player count! Now they can figure out which friends to throw in my face and then they can remind me that I do not spend enough time with my friends and then we can turn that game into an excuse to reunite after 5 years of no communication!

This will be a great way to reconnect with old friends and challenge them through games that they forgot they once joined. I can also make fun of my friends knowing that they stepped foot in the games I play. Now I can laugh at my friends for being better than them at videogames thank you roblox!!

15 Likes

Useful and cool but can we get more data besides just a UserId, like first time played and last time played?

24 Likes

This is pretty cool, actually. I could see a lot of cool things being done with this API, kinda like the friend status updates on Steam or what have you.

I think you would probably need to save that yourself in a datastore. There’s also something that gives you the first time the user started playing in AnalyticsService, though it utilizes EnumItems for that

6 Likes

It’d be much more efficient if this was provided by the API instead so that developers don’t need to burn through even more of the datastore budget whenever they need this information.

5 Likes

Are there any plans to overhaul ordered data stores? They are kind of limiting, idk if other people agree

8 Likes

I just tested this API and this is not the case. The API exposes your friend’s UserId even if they have all of these privacy settings turned off.

8 Likes

Cool I guess

We need friends who still play on Roblox first though, so I think this update came just a little too late.

2 Likes

Forgive me if I’ve missed something, what exactly is this?

3 Likes

cool, but what about the fact that new devs cant even test this without going through the tedius effort of setting up trusted friends?

just remove the R$ and 500 adult requiremtns, or make them smaller for new devs PLZ

The documentation says that the API returns an array of UserIDs, but in your provided example it returns an array of objects with an entry for the UserID. So which one is it?

1 Like

This is such a useful concept. It solves a problem everyone was facing but nobody was noticing.

2 Likes

It should be an array of UserIDs, the above example has also been updated. Thanks for asking!

4 Likes

I love this GetFriendsWhoPlayed API! It will really help with social features! P.S. I’m under a severe thunderstorm warning right now. Hopefully this storm passes for me without any trouble!

edit: the storm is over

1 Like

jokes aside, does this update respect the privacy setting that lets you disable the friends activity update? if no please implement it :folded_hands:

4 Likes

for thoses that mabye don’t know what privacy toggle im talking about, i’m talking about this specific toggle.

2 Likes

Is there a way to get information on whether that friend is currently in the game?
I use this API but it’s quite slow to give responses (sometimes incorrect ones). TeleportService:GetPlayerPlaceInstanceAsync()

Maybe try making a MemoryStore that keeps track of where in your game each player is?

https://create.roblox.com/docs/reference/engine/classes/Player#GetFriendsOnlineAsync