I need to get all the players friends and I have no idea how! I need only the friends that are online playing the game at that moment. Please someone help! I need this so if they want they can transfer to the same team
COMMUNITY QUESTION
how to get the players friends?
1 answer
local Player = game:GetService('Players').LocalPlayer -- Get the Player
local PlayersFriends = Player:GetOnlineFriends() -- This is how.
But in your case, since you need to allow them to transfer to the same team, you would need this.
local Players = game:GetService(Players)
local PlayersinPlayers = Players:GetPlayers() -- get the players
local AbleTeams = {}
for i, v in pairs(PlayersinPlayers) do -- and an example of how you can do it
if v ~= Players.LocalPlayer and Players.LocalPlayer:IsFreindsWith(v.UserId) then
table.insert(AbleTeams, v.Team)
end
end
--i think you can do it from here
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
player:GetOnlineFriends()
^ It's actually GetFriendsOnline http://wiki.roblox.com/index.php?title=API:Class/Player/GetFriendsOnline