This is a yielding function. When called, it will pause the Lua thread that called the function until a result is ready to be returned, without interrupting other scripts.
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:
|Id||int64||The friend's UserId|
|Username||string||The friend's username|
|DisplayName||string||The display name of the friend.|
|IsOnline||bool||If the friend is currently online|
See the code samples for an easy way to iterate over all a player’s friends.
The userId of the player being specified.
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.