I am trying to load the players friends locally, show it shows the players friends for them only and other players friends different. but im struggling how
task.wait()
function SpawnAllFriends(UserId)
local PlayersService = game:GetService("Players")
local FriendIDs = {}
local success, fail pcall(function()
local friendsList = PlayersService:GetFriendsAsync(UserId)
for page=1,4 do
for _,friend in pairs(friendsList:GetCurrentPage()) do
table.insert(FriendIDs, friend.Id)
end
if page ~= 4 then
local pass,err = pcall(function()
friendsList:AdvanceToNextPageAsync()
end)
if not pass then
break
end
end
end
end)
task.wait(2)
local Rigs = workspace.Rigs
for i, Rig in pairs(Rigs:GetChildren()) do
local success, err = pcall(function()
local TargetHumanoid = Rig:FindFirstChildWhichIsA("Humanoid")
if TargetHumanoid then
TargetHumanoid:ApplyDescriptionReset(PlayersService:GetHumanoidDescriptionFromUserId(FriendIDs[i]))
end
end)
if not success then
warn("Could not spawn "..FriendIDs[i].."'s character because: "..err)
end
end
end
SpawnAllFriends(369951478) -- Your userId here
i would like the userID to be the players so it shows their friends and not the other player’s
Humanoid:ApplyDescription() can only be used on server-side.
I would try making a blank HumanoidDescription, using Instance.new(instance, parentTo), and then setting the humanoid’s description using that description you just made.
I would see why this is limited to server-side, so I would have to make this on the server, or from the client using a remote event.