PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

GetFriendsAsync

The GetFriends Players function returns a FriendPages object which contains information for all of the given Player|Player's friends. The items within the FriendPages object are tables with the following fields:

Name Type Description
Id int64 The friend's UserId
Username string The friend's username
IsOnline bool If the friend is currently online

See the code samples for an easy way to iterate over all a player’s friends.

Parameters

Name Type Default Description

The userId of the player being specified.

Returns

Return Type Summary

A FriendPages object which contains information for all of the given player’s friends.


Code Samples


Print Roblox Friends

This code sample loads the Player/UserId of the player whose username is provided at the top of the script by using Players/GetUserIdFromNameAsync. Then, it gets a FriendPages object by calling Players/GetFriendsAsync and iterates over each entry using the iterPageItems function. The username of each friend is stored in a table, then printed at the end.