PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

GetGroupInfoAsync

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.

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.

Parameters

Name Type Default Description

The group ID of the group.

Returns

Return Type Summary

A dictionary of information about the group.


Code Samples


GroupService:GetGroupInfoAsync

local groupId = 377251
local group = game:GetService("GroupService"):GetGroupInfoAsync(groupId)

print(group.Name .. " has the following roles:")
for _, role in ipairs(group.Roles) do
   print("Rank " .. role.Rank .. ": " .. role.Name)
end

Load Group Emblem

The code in this sample spawns a Part in the Workspace that includes a texture of the given group’s emblem.

    local GroupService = game:GetService("GroupService")
    
    -- function to load a group's emblem
    local function getEmblemAsync(groupId)
    	local groupInfo = GroupService:GetGroupInfoAsync(groupId)
    	return groupInfo.EmblemUrl
    end
    
    -- create a part and decal to show the emblem
    local part = Instance.new("Part")
    part.Anchored = true
    part.CanCollide = false 
    part.Size = Vector3.new(5, 5, 1)
    part.Position = Vector3.new(0, 5, 0)
    local decal = Instance.new("Decal", part)
    
    -- parent the part to the workspace
    part.Parent = workspace
    
    -- set the texture
    decal.Texture = getEmblemAsync(377251)