i know how to get a player’s friendpage thing, but no idea how you convert that to your number of friends
i tried looking for ways on the devforum but there’s not much information on it i think
i know how to get a player’s friendpage thing, but no idea how you convert that to your number of friends
i tried looking for ways on the devforum but there’s not much information on it i think
how do i use this to get the friendcount of a player?
Loop through the pages until the end. There is a code sample on there.
Here is a script that gets all the player’s friends:
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local success, pages = pcall(function()
return Players:GetFriendsAsync(player.UserId)
end)
if success and pages then
local totalFriends = 0
while true do
local items = pages:GetCurrentPage()
totalFriends += #items
if pages.IsFinished then
break
end
pages:AdvanceToNextPageAsync()
end
print(`@{player.Name} has {totalFriends} friends.`)
end
end)
thanks a lot, i’ll use this for someething cool i think
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.