Can this function be used in a local script, and if so can it be tested in studio test servers or do I have to boot up a real one. Code in Question:
local Players = game:GetService(“Players”)
local SelectedTemplate = script.Parent.Parent.SelectedTemplate
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local ListTemplates = ReplicatedStorage:WaitForChild(“ListTemplates”)
local ScrollingFrame = script.Parent.Parent.Parent.ScrollingFrame
local LocalPlayer = Players.LocalPlayer
local Button = script.Parent
local FriendImage = ReplicatedStorage:WaitForChild(“FriendsListCloneImage”)
script.Parent.MouseButton1Click:Connect(function()
local success, pages = pcall(function()
print(Players:GetFriendsAsync(LocalPlayer.UserId)) --- This prints "Instance"
return Players:GetFriendsAsync(LocalPlayer.UserId)
end)
if success then
while true do
for _, friendInfo in ipairs(pages:GetCurrentPage()) do
local friendName = friendInfo.Username
local friendAvatar = Players:GetUserThumbnailAsync(friendInfo.Id, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size100x100)
-- Create a new image button for each friend
FriendImage:Clone()
FriendImage.Parent = ScrollingFrame
FriendImage.Name = _
if pages.IsFinished then
break
end
pages:AdvanceToNextPageAsync()
end
else
warn("Failed to load friends list.")
end
end)