#Friends Table Cap at 50 when i have 80 Friends

1 messages · Page 1 of 1 (latest)

modern dagger
#

im using the script from the offical roblox creator hub wiki but it only returns me 50 friends..

script.Parent.Equipped:Connect(function()
    local char = script.Parent.Parent
    local Players = game:GetService("Players")

    local USERNAME = char.Name

    local function iterPageItems(pages)
        return coroutine.wrap(function()
            local pagenum = 1
            while true do
                for _, item in ipairs(pages:GetCurrentPage()) do
                    coroutine.yield(item, pagenum)
                end
                if pages.IsFinished then
                    break
                end
                pages:AdvanceToNextPageAsync()
                pagenum = pagenum + 1
            end
        end)
    end

    -- 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)
    -- Iterate over the items in the pages. For FriendPages, these
    -- are tables of information about the friend, including Username.
    -- Collect each username in a table
    local usernames = {}
    for item, _pageNo in iterPageItems(friendPages) do
        table.insert(usernames, item.Username)
    end

    print("Friends of " .. USERNAME .. ": " .. table.concat(usernames, ", "))
    print(#usernames)
end)
crisp cloak
#

this is not correct

crisp cloak
modern dagger
#

it says 50

crisp cloak
# modern dagger 50

try this with your userid https://devforum.roblox.com/t/getfriendsasync-only-gets-50-off-my-friends/2441479/4 and print #tableOfFriends at the end