Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to use plr:GetFriendsOnline?

1 answer

✓ Accepted answer

GetFriendsOnline is a way to get any player who is online within' someones friendlist, returning an array of found friends.

Like so:

local Player = game.Players.LocalPlayer

local ArrayOfFriends = Player:GetFriendsOnline(1) -- Change this number to how many friends you want, max being 200.

for _,friend in pairs(ArrayOfFriends) do
	print(friend.UserName) -- prints friends name
end

5 comments

0

Also, keep in mind. If you leave GetFriendsOnline() empty, without a number. It will by default print 200 friends (or how many friends the player has which are online).

0

thanks..

0

the problem was i forgot to add .UserName, thanks

0

No worries.

This discussion is preserved as it was. New answers, comments, and votes are closed.