Hello devforum, I’m having some trouble with pcall().
What I’m trying to do is get the player’s online friends using this function. But the pcall always returns true, so the result is nil, even after success returned true.
This is the code:
local success, result = pcall(function()
player:GetFriendsOnline()
end)
if success then
for _, v in pairs(result) do
if v.PlaceId == mainGameId then
local newFriendGui = friendGui:Clone()
newFriendGui.Parent = scrollingFrame
newFriendGui.FriendName.Text = v.UserName
newFriendGui.PlayerId.Value = v.VisitorId
newFriendGui.TpHandler.Disabled = false
end
end
else
warn("Couldn't get online friends")
end
And this is the error I get all the time:
Basically the function for some reason returns nil, but the pcall’s success return is still true.
Thanks for reading.