You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
im trying to make a function that returns a players friends ids
- What is the issue? Include screenshots / videos if possible!
For some reason it returns an empty table
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
yes but didnt find anything
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
the function:
local module = {}
function module:GetPlayerFriendsIds(userid)
local PlayersFriends = {}
local success, page = pcall(function() return game:GetService("Players"):GetFriendsAsync(userid) end)
if success then
repeat
local info = page:GetCurrentPage()
table.insert(PlayersFriends, info.Id)
if not page.IsFinished then
page:AdvanceToNextPageAsync()
end
until page.IsFinished
end
return PlayersFriends
end
return module