Hello! I've been working on an in-game friendslist recently.
For some reason, I cannot get the UserId of a user. Here is my script;
local Players = game:GetService("Players") local player = Players.LocalPlayer local onlineFriends = player:GetFriendsOnline(8) for i, friend in pairs(onlineFriends) do print(friend.UserId) end
Output just prints nil.
For some weird reason, friend.UserName works, but friend.UserId doesn't. How could I get the userid?
To get the UserId of a friend you must use VisitorId, not sure why Roblox decided to do it like that. But it is what it is!
local Players = game:GetService("Players") local player = Players.LocalPlayer local onlineFriends = player:GetFriendsOnline(8) for i, friend in pairs(onlineFriends) do print(friend.VisitorId) end