Reference API Roblox

Engine API

Website

Related

Reference API Roblox

GroupService

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

This class is not replicated. Its interface does not cross the network boundary.
This class is not creatable. Instances of this class cannot be created with Instance.new.
This class is a service. It is a singleton that may be acquired with GetService.
Tags: [NotCreatable, Service, NotReplicated]

Member index 4

HistoryMember
483GetAlliesAsync(groupId: int64): StandardPages
483GetEnemiesAsync(groupId: int64): StandardPages
462GetGroupInfoAsync(groupId: int64): Variant
462GetGroupsAsync(userId: int64): Array
inherited from Instance
553Archivable: bool
635Capabilities: SecurityCapabilities
553Name: string
553Parent: Instance
635Sandboxed: bool
616UniqueId: UniqueId
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
486GetDescendants(): Array
486GetFullName(): string
641GetStyled(name: string): Variant
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
580IsPropertyModified(name: string): bool
573Remove(): null
576RemoveTag(tag: string): null
580ResetPropertyToDefault(name: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
648children(): Instances
553clone(): Instance
573destroy(): null
553findFirstChild(name: string, recursive: bool = false): Instance
648getChildren(): Instances
553isDescendantOf(ancestor: Instance): bool
573remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
553childAdded(child: Instance)
inherited from Object
647ClassName: string
647className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
650isA(className: string): bool
647Changed(property: string)

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 it's 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 group's a player is a member of, using GroupService:GetGroupsAsync(). Note, developers wishing to verify if a player is in a group should use the Player:IsInGroup() function 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.

History 15

Members 4

GetAlliesAsync

Parameters (1)
groupIdint64
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
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 to powerful",
    Roles = {
        [1] = {
            Name = "Apprentice",
            Rank = 1
        },
        [2] = {
            Name = "Warrior",
            Rank = 2
        },
        [3] = {
            Name = "Earth Walker",
            Rank = 255
        }
    }
}

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().

This function yields. It will block the calling thread until completion.

History 4

Tags: [Yields]

GetEnemiesAsync

Parameters (1)
groupIdint64
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
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 to powerful",
    Roles = {
        [1] = {
            Name = "Apprentice",
            Rank = 1
        },
        [2] = {
            Name = "Warrior",
            Rank = 2
        },
        [3] = {
            Name = "Earth Walker",
            Rank = 255
        }
    }
}

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().

This function yields. It will block the calling thread until completion.

History 4

Tags: [Yields]

GetGroupInfoAsync

Parameters (1)
groupIdint64
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
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 to 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.

This function yields. It will block the calling thread until completion.

History 3

Tags: [Yields]

GetGroupsAsync

Parameters (1)
userIdint64
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.

NameDescription
NameThe group's name
IdThe group ID
EmblemUrlAn asset url linking to the group's thumbnail (for example: http://www.roblox.com/asset/?id=276165514)
EmblemIdThe assetId of the emblem, the same which is used in the EmblemUrl
RankThe rankId the player has (for example: 255 for the owner)
RoleThe name of the player's grouprank (for example: Group Owner)
IsPrimaryA boolean indicating if this is the player's primary group
IsInClanA 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.

This function yields. It will block the calling thread until completion.

History 3

Tags: [Yields]

Settings