This is a yielding function. When called, it will pause the Lua thread that called the function until a result is ready to be returned, without interrupting other scripts.
AwardBadge grants a
articles/Badges Special Game Awards|badge given the player’s
Player/UserId|UserId and the 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 (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
ModuleScripteventually required by a
Script, not from a
- The badge must be awarded in a place that is part of the game associated with the badge.
- The owner of the place must also own the badge (for example, the owner must not have deleted the badge).
- The badge must be enabled; check this using the
IsEnabledproperty of the badge fetched via
The ID of the badge to be awarded.
Awarding a Badge
Using the following example, the
awardBadge() function can be called whenever it fits your game design. Using properties of the badge fetched via
BadgeService/GetBadgeInfoAsync|BadgeService:GetBadgeInfoAsync(), it confirms that the badge can be awarded and does so using