Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
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.