PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

AwardBadge

AwardBadge will grant a player a badge given a Player's Player/UserId|UserId and a badge ID. In order to successfully award a badge, the following criteria must be met:

  • The player must be presently connected to the game.
  • The player must not already have the badge.*
  • Badges must be awarded on the server, i.e. from a Script or ModuleScript eventually required by a Script, instead of a LocalScript
  • Only Roblox game servers may award badges, i.e. badges cannot be awarded in Studio.
  • The badge must be awarded in a place that is part of the game associated with the badge (checked using BadgeService/IsLegal|IsLegal)
  • The owner of the place must also own the badge, i.e. the owner must not have deleted the badge.
  • The badge must not have been disabled (checked using BadgeService/IsDisabled|IsDisabled).

A player may delete an awarded badge from their inventory and be awarded the badge again.

See also

  • BadgeService/GetBadgeInfoAsync
  • BadgeService/AwardBadge
  • BadgeService/UserHasBadgeAsync

Parameters

Name Type Default Description

The Player/UserId of the user the badge is to be awarded to

The ID of the badge to be awarded

Returns

Return Type Summary

True if the badge was rewarded successfully.


Code Samples


Awarding a Badge

This code sample includes a simple function for awarding a badge.


Met the Creator Badge

The following code sample gives an example of a ‘met the creator’ badge system. This script will award a specified badge (BADGE_ID) to anyone who is in a server at the same time as the user associated with OWNER_ID.