GroupService
GroupService is a service that allows developers to fetch information about a Roblox group from within a game.
| Memory category | Instances |
|---|
Member index 7
Description
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:IsInGroup() 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.
History 18
- 700 Add ShowJoinPrompt
- 700 Add PromptJoinCompleted
- 700 Add PromptJoinAsync
- 483 Change ReturnType of GetEnemiesAsync from Instance to StandardPages
- 483 Change ReturnType of GetAlliesAsync from Instance to StandardPages
- 462 Change ThreadSafety of GetGroupsAsync from to Unsafe
- 462 Change ThreadSafety of GetGroupInfoAsync from to Unsafe
- 462 Change ThreadSafety of GetEnemiesAsync from to Unsafe
- 462 Change ThreadSafety of GetAlliesAsync from to Unsafe
- 325 Change Parameters of GetGroupsAsync from (userId: int) to (userId: int64)
- 325 Change Parameters of GetGroupInfoAsync from (groupId: int) to (groupId: int64)
- 325 Change Parameters of GetEnemiesAsync from (groupId: int) to (groupId: int64)
- 325 Change Parameters of GetAlliesAsync from (groupId: int) to (groupId: int64)
- 214 Add GetGroupsAsync
- 164 Add GetGroupInfoAsync
- 164 Add GetEnemiesAsync
- 164 Add GetAlliesAsync
- 164 Add GroupService
Members 7
GetAlliesAsync
| Parameters (1) | ||
|---|---|---|
| groupId | int64 | |
| Returns (1) | ||
| StandardPages | ||
Returns a StandardPages object 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
Note, as this function returns a StandardPages object 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().
| Thread safety | Unsafe |
|---|
History 4
- 483 Change ReturnType of GetAlliesAsync from Instance to StandardPages
- 462 Change ThreadSafety of GetAlliesAsync from to Unsafe
- 325 Change Parameters of GetAlliesAsync from (groupId: int) to (groupId: int64)
- 164 Add GetAlliesAsync
GetEnemiesAsync
| Parameters (1) | ||
|---|---|---|
| groupId | int64 | |
| Returns (1) | ||
| StandardPages | ||
Returns a StandardPages object 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
Note, as this function returns a StandardPages object 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().
| Thread safety | Unsafe |
|---|
History 4
- 483 Change ReturnType of GetEnemiesAsync from Instance to StandardPages
- 462 Change ThreadSafety of GetEnemiesAsync from to Unsafe
- 325 Change Parameters of GetEnemiesAsync from (groupId: int) to (groupId: int64)
- 164 Add GetEnemiesAsync
GetGroupInfoAsync
| Parameters (1) | ||
|---|---|---|
| groupId | int64 | |
| Returns (1) | ||
| Variant | ||
Returns a table containing information about the given group.
The table returned is the same format as that returned in GroupService:GetAlliesAsync() and GroupService:GetEnemiesAsync(). This format can be seen below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
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.
| Thread safety | Unsafe |
|---|
History 3
- 462 Change ThreadSafety of GetGroupInfoAsync from to Unsafe
- 325 Change Parameters of GetGroupInfoAsync from (groupId: int) to (groupId: int64)
- 164 Add GetGroupInfoAsync
GetGroupsAsync
| Parameters (1) | ||
|---|---|---|
| userId | int64 | |
| Returns (1) | ||
| Array | ||
Warning: The IsInClan property in the returned table will always return false and exists for backwards compatibility. The Clans feature was sunset from the Roblox platform in 2016.
This function 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 | Description |
|---|---|
| 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 |
Note unlike GroupService:GetAlliesAsync() and GroupService:GetEnemiesAsync(), GetGroupsAsync returns a table rather than a StandardPages object.
| Thread safety | Unsafe |
|---|
History 3
- 462 Change ThreadSafety of GetGroupsAsync from to Unsafe
- 325 Change Parameters of GetGroupsAsync from (userId: int) to (userId: int64)
- 214 Add GetGroupsAsync
PromptJoinAsync
| Parameters (1) | ||
|---|---|---|
| groupId | int64 | |
| Returns (1) | ||
| GroupMembershipStatus | ||
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 return GroupMembershipStatus.None.
Note that you can use Player:IsInGroup() to check the player's current membership status before calling this method.
| Thread safety | Unsafe |
|---|
History 1
- 700 Add PromptJoinAsync
PromptJoinCompleted
| Parameters (4) | ||
|---|---|---|
| groupId | int64 | |
| success | bool | |
| groupMembershipStatus | GroupMembershipStatus | |
| errorMessage | string | |
| Returns (1) | ||
| null | ||
| Security | RobloxScriptSecurity |
|---|---|
| Thread safety | Unsafe |
History 1
ShowJoinPrompt
| Parameters (1) | |
|---|---|
| groupId | int64 |
| Security | RobloxScriptSecurity |
|---|---|
| Thread safety | Unsafe |
History 1
- 700 Add ShowJoinPrompt