1 | |
2 | |
3 | local Players = game:GetService("Players") |
4 | |
5 | local USERNAME = "XiDuxrentusxX" |
6 | |
7 | local function iterPageItems(pages) |
8 | return coroutine.wrap(function() |
9 | local pagenum = 1 |
10 | while true do |
11 | for _, item in ipairs(pages:GetCurrentPage()) do |
12 | coroutine.yield(item, pagenum) |
13 | end |
14 | if pages.IsFinished then |
15 | break |
16 | end |
17 | pages:AdvanceToNextPageAsync() |
18 | pagenum = pagenum + 1 |
19 | end |
20 | end) |
21 | end |
22 | |
23 | |
24 | local userId = Players:GetUserIdFromNameAsync(USERNAME) |
25 | |
26 | local friendPages = Players:GetFriendsAsync(userId) |
27 | |
28 | |
29 | |
30 | local usernames = {} |
31 | for item, _pageNo in iterPageItems(friendPages) do |
32 | table.insert(usernames, item.Username) |
33 | end |
34 | |
35 | print("Friends of " .. USERNAME .. ": " .. table.concat(usernames, ", ")) |