This is a yielding function. When called, it will pause the Lua thread that called the function until a result is ready to be returned, without interrupting other scripts.
Returns a list of tables containing information on all of the groups a given player is a member of.
The list returned will include an entry for every group the player is a member of. These entries are tables with the following fields.
- Name: The group’s name
- Id: The group ID
- EmblemUrl: An asset url linking to the group’s thumbnail (for example: http://www.roblox.com/asset/?id=276165514)
- EmblemId: The assetId of the emblem, the same which is used in the EmblemUrl
- Rank: The rankId the player has (for example: 255 for the owner)
- Role: The name of the player’s grouprank (for example: Group Owner)
- IsPrimary: A boolean indicating if this is the player’s primary group
- IsInClan: A boolean indicating if the player is in this group’s clan
GroupService/GetEnemiesAsync, GetGroupsAsync returns a table rather than a
An array of dictionaries containing information on the group’s the player is a member of.
This code sample will print information on all of the groups a player is a member of when they join the game, using
local GroupService = game:GetService("GroupService") local Players = game:GetService("Players") local function playerAdded(player) -- load a list of info on all groups the player is a member of local groups = GroupService:GetGroupsAsync(player.UserId) -- go through this list for _, groupInfo in pairs(groups) do -- print all of the entries for key, value in pairs(groupInfo) do print(key..": "..tostring(value)) end -- print a divider print("--") end end -- listen for new players Players.PlayerAdded:Connect(playerAdded) -- go through existing players for _, player in pairs(Players:GetPlayers()) do playerAdded(player) end