We use cookies on this site to enhance your user experience

How to Get a List of Online Friends

How to Get a List of Online Friends

Sep 02 2018, 10:43 AM PST

This example demonstrates how to get a dictionary of a player’s online friends.

It will returns at max as many friends as specified in the argument, which we set to 10. If the argument is blank, the default max number of friends to return is 200.

The example then prints the names of all online friends.

local player = game.Players.LocalPlayer

local dict = player:GetFriendsOnline(10)

for i,friend in pairs(dict) do