# GroupService

Roblox Engine API class from Roblox Studio 0.744.0.7441077 (version-7aaa6838d36c4448).

- Inherits from, nearest first: [Instance](https://rapi.sleaze.dev/classes/Instance.md), [Object](https://rapi.sleaze.dev/classes/Object.md)
- Tags: Not creatable, Not replicated, Service
- Memory category: Instances
- HTML page: https://rapi.sleaze.dev/classes/GroupService/
- Roblox documentation: https://create.roblox.com/docs/reference/engine/classes/GroupService

GroupService is a service that allows developers to fetch information about a Roblox group from within a game.

## Methods

### GetAlliesAsync

```luau
GroupService:GetAlliesAsync(groupId: number): StandardPages
```

- Tags: Yields, Capabilities: Groups

Returns a [`StandardPages`](https://rapi.sleaze.dev/classes/StandardPages.md) object including information on all of the specified group's allies.

Parameters:

- `groupId`: The group's ID.

Returns: A [`StandardPages`](https://rapi.sleaze.dev/classes/StandardPages.md) object containing group information tables for each of the specified group's allies.

### GetEnemiesAsync

```luau
GroupService:GetEnemiesAsync(groupId: number): StandardPages
```

- Tags: Yields, Capabilities: Groups

Returns a [`StandardPages`](https://rapi.sleaze.dev/classes/StandardPages.md) object including information on all of the specified group's enemies.

Parameters:

- `groupId`: The group's ID.

Returns: A [`StandardPages`](https://rapi.sleaze.dev/classes/StandardPages.md) object containing group information tables for each of the specified group's enemies.

### GetGroupInfoAsync

```luau
GroupService:GetGroupInfoAsync(groupId: number): any
```

- Tags: Yields, Capabilities: Groups

Returns a table containing information about the given group.

Parameters:

- `groupId`: The group ID of the group.

Returns: A dictionary of information about the group.

### GetGroupsAsync

```luau
GroupService:GetGroupsAsync(userId: User): { any }
```

- Tags: Yields, Capabilities: Groups

Returns a list of tables containing information on all of the groups a given player is a member of.

Parameters:

- `userId`: The [`Player.UserId`](https://rapi.sleaze.dev/classes/Player.md) of the user.

Returns: An array of dictionaries containing information on the group's the [`Player`](https://rapi.sleaze.dev/classes/Player.md) is a member of.

### GetRolesInGroupAsync

```luau
GroupService:GetRolesInGroupAsync(userId: User, groupId: number): any
```

- Tags: Yields, Capabilities: Groups

Returns all roles held by the specified user in the specified group, supporting multi-role group membership.

Parameters:

- `userId`: The user's ID.
- `groupId`: The group's ID.

Returns: A table with two fields: `IsMember` (boolean) and `Roles` (array of public role tables). Each role table contains `Id` (integer), [`Name`](https://rapi.sleaze.dev/classes/Instance.md) (string), and `Rank` (integer). The array is ordered from highest to lowest role.

### PromptJoinAsync

```luau
GroupService:PromptJoinAsync(groupId: number): Enum.GroupMembershipStatus
```

- Tags: Yields, Capabilities: Groups

Prompts the local [`Player`](https://rapi.sleaze.dev/classes/Player.md) to join a specified Roblox group via a native modal.

Parameters:

- `groupId`: ID of the group to prompt the player to join. This must be a valid group ID.

Returns: `GroupMembershipStatus` indicating the player's group membership status after the prompt is closed. If the player closes the prompt without joining, this will return `GroupMembershipStatus.None` or their previous status if they were already a member.

### PromptJoinCompleted

```luau
GroupService:PromptJoinCompleted(groupId: number, success: boolean, groupMembershipStatus: Enum.GroupMembershipStatus, errorMessage: string)
```

- Tags: Roblox script security, Capabilities: Groups

## Events

### ShowJoinPrompt

```luau
GroupService.ShowJoinPrompt: RBXScriptSignal<(groupId: number)>
```

- Tags: Roblox script security, Capabilities: Groups

## Inherited members

- From [Instance](https://rapi.sleaze.dev/classes/Instance.md): `Archivable`, `archivable`, `Attributes`, `AttributesReplicate`, `AttributesSerialize`, `HistoryId`, `Name`, `Parent`, `PredictionMode`, `PropertyStatusStudio`, `RobloxLocked`, `SerializedOverrides`, `SourceAssetId`, `Tags`, `UniqueId`, `numExpectedDirectChildren`, `DataCost`, `Capabilities`, `DefinesCapabilities`, `IsInSandbox`, `Sandboxed`, `AddTag`, `ClearAllChildren`, `Clone`, `Destroy`, `FindFirstAncestor`, `FindFirstAncestorOfClass`, `FindFirstAncestorWhichIsA`, `FindFirstChild`, `FindFirstChildOfClass`, `FindFirstChildWhichIsA`, `FindFirstDescendant`, `GetActor`, `GetAttribute`, `GetAttributeChangedSignal`, `GetAttributes`, `GetChildren`, `GetDebugId`, `GetDescendants`, `GetFullName`, `GetStyled`, `GetStyledPropertyChangedSignal`, `GetTags`, `HasTag`, `IsAncestorOf`, `IsDescendantOf`, `IsPropertyModified`, `QueryDescendants`, `RemoveTag`, `ResetPropertyToDefault`, `SetAttribute`, `WaitForChild`, `Remove`, `children`, `clone`, `destroy`, `findFirstChild`, `getChildren`, `isDescendantOf`, `remove`, `AncestryChanged`, `AttributeChanged`, `ChildAdded`, `ChildRemoved`, `DescendantAdded`, `DescendantRemoving`, `Destroying`, `StyledPropertiesChanged`, `childAdded`
- From [Object](https://rapi.sleaze.dev/classes/Object.md): `ClassName`, `className`, `GetPropertyChangedSignal`, `IsA`, `isA`, `Changed`
