Engine Class
FriendPages
Code Samples
Print Roblox Friends
local Players = game:GetService("Players")
local USERNAME = "Cozecant"
-- First, get the user ID of the player
local userId = Players:GetUserIdFromNameAsync(USERNAME)
-- Then, get a FriendPages object for their friends
local friendPages = Players:GetFriendsAsync(userId)
-- Walk the pages, collecting the username of every friend. Each page entry is
-- a table of information about the friend, including Username.
local usernames = {}
while true do
for _, friend in ipairs(friendPages:GetCurrentPage()) do
table.insert(usernames, friend.Username)
end
if friendPages.IsFinished then
break
end
friendPages:AdvanceToNextPageAsync()
end
print("Friends of " .. USERNAME .. ": " .. table.concat(usernames, ", "))