Reference API Roblox

Engine API

Website

Related

Reference API Roblox

BadgeService

Provides information on badges and awards them.

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]

Member index 9

HistoryMember
462AwardBadge(userId: int64, badgeId: int64): bool
615CheckUserBadgesAsync(userId: int64, badgeIds: Array): Array
462GetBadgeInfoAsync(badgeId: int64): Dictionary
462IsDisabled(badgeId: int64): bool
462IsLegal(badgeId: int64): bool
462UserHasBadge(userId: int64, badgeId: int64): bool
462UserHasBadgeAsync(userId: int64, badgeId: int64): bool
462BadgeAwarded(message: string, userId: int64, badgeId: int64)
462OnBadgeAwarded(userId: int64, creatorId: int64, badgeId: int64)
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)

Removed member index 6

HistoryMember
310SetAwardBadgeUrl(url: string): void
310SetHasBadgeCooldown(seconds: int): void
310SetHasBadgeUrl(url: string): void
310SetIsBadgeDisabledUrl(url: string): void
310SetIsBadgeLegalUrl(url: string): void
310SetPlaceId(placeId: int): void

Description

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

History 41

Members 9

AwardBadge

Parameters (2)
userIdint64
badgeIdint64
Returns (1)
bool

Grants a Player a badge with the UserId and the badge ID. Rate limit: 50 + 35 * [number of users] per minute. In order to successfully award a badge:

  • The player must be presently connected to the game.
  • 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-side Script or a ModuleScript eventually required by a Script, not from a LocalScript.
  • The badge must be awarded in a place that is part of the game associated with the badge.
  • The badge must be enabled; check this using the IsEnabled property of the badge fetched through BadgeService:GetBadgeInfoAsync().

See also:

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

History 3

Tags: [Yields]

BadgeAwarded

Parameters (3)
messagestring
userIdint64
badgeIdint64

History 6

CheckUserBadgesAsync

Parameters (2)
userIdint64
badgeIdsArray
Returns (1)
Array

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.

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

Any set of badges for any experience can be queried, no matter who created the badges or which experiences they are for. Any UserId can be used in a Script, but in a LocalScript, only the UserId of the local user whose client is running the script can be used.

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

History 1

Tags: [Yields]

GetBadgeInfoAsync

Parameters (1)
badgeIdint64
Returns (1)
Dictionary

This function fetches information about a badge given its ID. It takes a brief moment to load the information from the Roblox website; repeated calls will cache for a short duration. It returns a dictionary with the following fields:

KeyTypeDescription
NamestringThe name of the badge.
DescriptionstringThe description of the badge.
IconImageIdint64The asset ID of the image for the badge.
IsEnabledboolIndicates whether the badge is available to be awarded.

See also:

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

History 2

Tags: [Yields]

IsDisabled

Parameters (1)
badgeIdint64
Returns (1)
bool

This function returns whether the badge with the given id is marked disabled on the Roblox website. A badge can be disabled by its owner on its page on the Roblox website, in the settings sub-menu. When a badge is disabled, this function returns true and the badge can no longer be awarded using AwardBadge. A badge may be quickly re-enabled through the same menu.

In Studio, a badge can only be tested if it is disabled. Calling this function with an enabled badge in Studio will return true and produce a warning "Sorry, badges can only be tested if they are disabled on Roblox game servers".

Note that even if a badge is enabled it may not necessarily be awardable (for example if it isn't associated with the current game). See AwardBadge for more information on the criteria required for awarding badges.

Badges that are associated with special events are a common reason for a badge to be disabled. Often, it is easier to simply disable a badge instead of hard-coding a time check for when some event ends.

This function is deprecated. It exists only for backward compatibility, and should not be used for new work.
This function yields. It will block the calling thread until completion.

History 4

Tags: [Yields, Deprecated]

IsLegal

Parameters (1)
badgeIdint64
Returns (1)
bool

This function determines if a given badge is associated with the current game. It returns true if the badge is associated with the current game.

Badges can only be awarded from a place that is part of the game associated with the badge. This means, for example, a developer cannot award a badge associated with another developer's game.

Even if this returns true, a badge may still not be award-able. For example, it may be disabled. For more information on the criteria for awarding badges see AwardBadge.

This function is deprecated. It exists only for backward compatibility, and should not be used for new work.
This function yields. It will block the calling thread until completion.

History 4

Tags: [Yields, Deprecated]

OnBadgeAwarded

Parameters (3)
userIdint64
creatorIdint64
badgeIdint64

History 2

UserHasBadge

Parameters (2)
userIdint64
badgeIdint64
Returns (1)
bool

Checks and returns whether a Player owns a badge given their UserId and the badge ID. You can call the function from the server in a Script or ModuleScript eventually required by a Script, and the user in question must be present in the server for the query to run. When calling the method from the client in a LocalScript, it only works for the local user whose client is running the script.

Any badge for any game can be queried, no matter who created the badge or which experience it is used for.

This function is deprecated. It exists only for backward compatibility, and should not be used for new work.
This function yields. It will block the calling thread until completion.

History 4

Tags: [Yields, Deprecated]

UserHasBadgeAsync

Parameters (2)
userIdint64
badgeIdint64
Returns (1)
bool

Checks and returns whether a Player owns a badge given their UserId and the badge ID. Rate limit: 50 + 35 * [number of players] per minute. You can call the function from the server in a Script or ModuleScript eventually required by a Script, and the user in question must be present in the server for the query to run. When calling the method from the client in a LocalScript, it only works for the local user whose client is running the script.

Any badge for any game can be queried, no matter who created the badge or which experience it is used for.

See also:

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

History 2

Tags: [Yields]

Removed members 6

SetAwardBadgeUrl

Parameters (1)
urlstring
Returns (1)
void

History 2

SetHasBadgeCooldown

Parameters (1)
secondsint
Returns (1)
void

History 2

SetHasBadgeUrl

Parameters (1)
urlstring
Returns (1)
void

History 2

SetIsBadgeDisabledUrl

Parameters (1)
urlstring
Returns (1)
void

History 2

SetIsBadgeLegalUrl

Parameters (1)
urlstring
Returns (1)
void

History 2

SetPlaceId

Parameters (1)
placeIdint
Returns (1)
void

History 2

Settings