Skip to content

Service · inherits Instance

BadgeService

Official docs ↗

Provides information on badges and awards them.

About BadgeService

BadgeService provides information and functionality related to badges. Badges are used across the platform to recognize a player's achievements and activity. Upon awarding a badge to a player, it is added to their inventory and displayed on their profile page.

Methods 5

  • AwardBadgeAsync(userId: User, badgeId: int64) → booleanYieldsAward a badge to a player given the ID of each.

    Grants a Player a badge with the UserId and the badge ID.

    In order to successfully award a badge:

    • The player must be presently connected to the experience.
    • The player must not already have the badge (note that a player may delete an awarded badge from their profile and be awarded the badge again).
    • The badge must be awarded from a server script (a Script with RunContext of RunContext.Server or RunContext.Legacy) or a ModuleScript eventually required by one, not from a client script.
    • The badge must be awarded in a place that is part of the experience associated with the badge.
    • The badge must be enabled; check this using the IsEnabled property of the badge fetched through BadgeService.GetBadgeInfoAsync.

    Rate limit is 50 + 35 * [number of users] per minute.

  • CheckUserBadgesAsync(userId: User, badgeIds: Array) → ArrayYieldsChecks a list of badge IDs against a UserId and returns a list of badge IDs that the player owns.

    Checks a list of badge IDs against a UserId and returns a list of badge IDs that the player owns. This method supports batches of up to 10 badges; use BadgeService.UserHasBadgeAsync for single badge lookups.

    When called from a server script, any UserId can be used. If the user with the target user ID has not recently been in the server, only badge IDs that are associated with the requesting experience will be checked, and any badge IDs that are not associated with the requesting experience will not be included in the response (as if they were not owned).

    For users that have recently been in the server, any badges for any experiences can be queried, no matter who created the badge or which experience it is used for.

    In a client script (a LocalScript or a Script with RunContext of RunContext.Client), only the UserId of the local user whose client is running the script can be used.

    Rate limit is 10 + 5 * [number of players] per minute in each server.

  • GetBadgeInfoAsync(badgeId: int64) → DictionaryYieldsFetch information about a badge given its ID.

    This method fetches information about a badge given its ID and returns a dictionary with the following fields:

    This method takes a brief moment to load the information from Roblox; repeated calls will cache for a short duration.

  • GetUserBadgesAsync(userId: User, badgeIds: Array) → ArrayYieldsChecks a list of badge IDs against a User and returns, for each badge the player owns, its ID and the date it was awarded.

    Checks a list of badge IDs against a User and returns, for each badge the player owns, a dictionary containing the badge's ID and the date it was awarded. This method supports batches of up to 100 badges; use BadgeService.UserHasBadgeAsync for single badge lookups.

    Each entry in the returned list is a dictionary with the following fields:

    When called from a server script, any User can be used. If the user with the target User has not recently been in the server, only badge IDs that are associated with the requesting experience will be checked, and any badge IDs that are not associated with the requesting experience will not be included in the response (as if they were not owned).

    For users that have recently been in the server, any badges for any experiences can be queried, no matter who created the badge or which experience it is used for.

    In a client script (a LocalScript or a Script with RunContext of RunContext.Client), only the User of the local user whose client is running the script can be used.

    Rate limit is 10 + 5 * [number of players] per minute in each server.

  • UserHasBadgeAsync(userId: User, badgeId: int64) → booleanYieldsChecks whether a player has the badge given the Player.UserId and the badge ID.

    Checks and returns whether a Player owns a badge given their UserId and the badge ID. You can call this method from a server script or a ModuleScript eventually required by one. When calling this method from a client script (a LocalScript or a Script with RunContext of RunContext.Client), it only works for the local user whose client is running the script.

    When called from a server script, any UserId can be used. If the user with the target user ID has not recently been in the server, only badge IDs that are associated with the requesting experience will be checked. If the requested badge ID is not associated with the requesting experience and the target user has not recently been in the server, the method behaves as if the badge is not owned.

    For users that have recently been in the server, any badge for any experience can be queried, no matter who created the badge or which experience it is used for.

    Rate limit is 50 + 35 * [number of players] per minute.

BadgeService 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.