-
What do you want to achieve? a character as a friend of the player
-
What is the issue? it doesnt work, but prints everything by the first and last line of code
-
What solutions have you tried so far? every single yt video and forum
also, i got every friend userID in my table, but wont create a model like one of those
local Players = game:GetService("Players")
local player = Players.PlayerAdded:Wait()
local friends = Players:GetFriendsAsync(player.UserId)
local ids = table.create(200)
local count = 0
while true do
for _, item in ipairs(friends:GetCurrentPage()) do
print(count, item.Id)
count += 1
ids[count] = item.Id
end
if friends.IsFinished then
break
end
friends:AdvanceToNextPageAsync()
end
local randomFriendId = ids[math.random(1,count)]
local a = game:GetService("Players"):GetCharacterAppearanceAsync(ids[math.random(0,count)])
any idea why this doesnt work or maybe you have a code that can do what im asking?