Service · inherits Instance
GroupService
GroupService is a service that allows developers to fetch information about a Roblox group from within a game.
About GroupService
GroupService is a service that allows developers to fetch information about
a Roblox group from within a game.
Basic information on the group, including its name, description, owner, roles
and emblem can be fetched using GroupService.GetGroupInfoAsync.
Lists of a group's allies and enemies can be fetched using
GroupService.GetAlliesAsync and
GroupService.GetEnemiesAsync.
GroupService can also be used to fetch a list of groups a player is a member
of, using GroupService.GetGroupsAsync. If you wish to verify if a
player is in a group, use the Player.IsInGroupAsync method rather
than GroupService.GetGroupsAsync.
The service has a number of useful applications, such as detecting if a player
is an ally or enemy upon joining the game, or prompting a player to join a
group using the GroupService.PromptJoinAsync method.
Methods 6
GetAlliesAsync
(groupId: int64) → StandardPagesYieldsReturns aStandardPagesobject including information on all of the specified group's allies.Returns a
StandardPagesobject including information on all of the specified group's allies.This pages does not include a list of group IDs but instead a list of group information tables, mirroring the format of those returned by
GroupService.GetGroupInfoAsync. See below for the structure of these tables.group = { Name = "Knights of the Seventh Sanctum", Id = 377251, Owner = { Name = "Vilicus", Id = 23415609 }, EmblemUrl = "http://www.roblox.com/asset/?id=60428602", Description = "We fight alongside the balance to make sure no one becomes too powerful", Roles = { [1] = { Name = "Apprentice", Rank = 1 }, [2] = { Name = "Warrior", Rank = 2 }, [3] = { Name = "Earth Walker", Rank = 255 } } }Note, as this function returns a
StandardPagesobject rather than an array, developers may wish to convert it to an array for ease of use (see examples).This function has a number of useful applications, including detecting if a player is a member of an allied group.
For enemies, use
GroupService.GetEnemiesAsync.GetEnemiesAsync
(groupId: int64) → StandardPagesYieldsReturns aStandardPagesobject including information on all of the specified group's enemies.Returns a
StandardPagesobject including information on all of the specified group's enemies.This pages does not include a list of group IDs but instead a list of group information tables, mirroring the format of those returned by
GroupService.GetGroupInfoAsync. See below for the structure of these tables.group = { Name = "Knights of the Seventh Sanctum", Id = 377251, Owner = { Name = "Vilicus", Id = 23415609 }, EmblemUrl = "http://www.roblox.com/asset/?id=60428602", Description = "We fight alongside the balance to make sure no one becomes too powerful", Roles = { [1] = { Name = "Apprentice", Rank = 1 }, [2] = { Name = "Warrior", Rank = 2 }, [3] = { Name = "Earth Walker", Rank = 255 } } }Note, as this function returns a
StandardPagesobject rather than an array, developers may wish to convert it to an array for ease of use (see examples).This function has a number of useful applications, including detecting if a player is a member of an enemy group.
For allies, use
GroupService.GetAlliesAsync.GetGroupInfoAsync
(groupId: int64) → VariantYieldsReturns a table containing information about the given group.Returns a table containing information about the given group.
The table returned is the same format as that returned in
GroupService.GetAlliesAsyncandGroupService.GetEnemiesAsync. This format can be seen below.group = { Name = "Knights of the Seventh Sanctum", Id = 377251, Owner = { Name = "Vilicus", Id = 23415609 }, EmblemUrl = "http://www.roblox.com/asset/?id=60428602", Description = "We fight alongside the balance to make sure no one becomes too powerful", Roles = { [1] = { Name = "Apprentice", Rank = 1 }, [2] = { Name = "Warrior", Rank = 2 }, [3] = { Name = "Earth Walker", Rank = 255 } } }Note, if a group has no owner the Owner field will be set to
nil.This function has a number of useful applications, including loading the latest description and logo of a group for display in a group base.
GetGroupsAsync
(userId: User) → ArrayYieldsReturns a list of tables containing information on all of the groups a given player is a member of.This function returns a list of tables containing information on all of the groups a given
Playeris 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.
Note unlike
GroupService.GetAlliesAsyncandGroupService.GetEnemiesAsync, GetGroupsAsync returns a table rather than aStandardPagesobject.GetRolesInGroupAsync
(userId: User, groupId: int64) → VariantYieldsReturns all roles held by the specified user in the specified group, supporting multi-role group membership.Returns a table describing all roles the specified user holds in the specified group. In a multi-role world, a user may belong to more than one role simultaneously.
The returned table has the following structure:
Key Type Description IsMember boolean trueif the user is a member of the groupRoles array Array of role tables (empty if not a member or no non-base roles) Each entry in the
Rolesarray has the following structure:Key Type Description Id integer Unique role ID Name string Display name of the role Rank integer Rank value (0–255) The
Rolesarray is ordered from the highest role to the lowest role. Only public roles are included. A role'sRankvalue is retained for backwards compatibility, but does not determine its position in the role hierarchy. Use the stableIdto identify a role.This method supersedes
Player.GetRankInGroupAsyncandPlayer.GetRoleInGroupAsync, which return only the member's highest public role.This call may not yield the most up-to-date information. Results are cached per user and group, so multiple calls with the same
userIdandgroupIdmay yield the same result until the cache expires. The caching behavior is on a per-peer basis: a server does not share the same cache as a client.When a player joins a group in-experience due to a call to
GroupService.PromptJoinAsync, any cached result for that player and group will be cleared on the client where the prompt was shown.PromptJoinAsync
(groupId: int64) → GroupMembershipStatusYieldsPrompts the localPlayerto join a specified Roblox group via a native modal.PromptJoinAsync()displays a prompt to the local player through which they may join the specified Roblox group. The group must exist and the player must meet the eligibility criteria to join. If the player is ineligible, this method will returnGroupMembershipStatus.None.Note that you can use
Player.IsInGroupAsyncto check the player's current membership status before calling this method.If the player successfully joins, any cached results from
GroupService.GetRolesInGroupAsync,Player.GetRankInGroupAsync, andPlayer.GetRoleInGroupAsyncfor that player and group will be cleared on the client where the prompt was shown.
GroupService also has every member of Instance. Deprecated and Roblox-only members are hidden.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.