Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions content/en-us/production/publishing/badges.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ A badge's ID is its unique identifier. You'll need this ID when implementing wor

### Award badges

You can award badges to players throughout your experience by calling the `Class.BadgeService:AwardBadge()` method in a server-side `Class.Script`. `Class.BadgeService:GetBadgeInfoAsync()` returns properties of the badge, including `IsEnabled` which confirms whether or not the badge can be awarded to a player. You can enable or disable a badge from the **Configure Badge** form on the [Creator Dashboard](https://create.roblox.com/dashboard/creations).
You can award badges to players throughout your experience by calling the `Class.BadgeService:AwardBadgeAsync()` method in a server-side `Class.Script`. `Class.BadgeService:GetBadgeInfoAsync()` returns properties of the badge, including `IsEnabled` which confirms whether or not the badge can be awarded to a player. You can enable or disable a badge from the **Configure Badge** form on the [Creator Dashboard](https://create.roblox.com/dashboard/creations).

The following is an example of a safe function for awarding badges to players.

Expand All @@ -101,7 +101,7 @@ local function awardBadge(player, badgeId)
-- Confirm that badge can be awarded
if badgeInfo.IsEnabled then
-- Award badge
local awarded, errorMessage = pcall(BadgeService.AwardBadge, BadgeService, player.UserId, badgeId)
local awarded, errorMessage = pcall(BadgeService.AwardBadgeAsync, BadgeService, player.UserId, badgeId)
if not awarded then
warn("Error while awarding badge:", errorMessage)
end
Expand Down
4 changes: 2 additions & 2 deletions content/en-us/reference/engine/classes/BadgeService.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ methods:

See also:

- `Class.BadgeService:AwardBadge()`
- `Class.BadgeService:AwardBadgeAsync()`
- `Class.BadgeService:UserHasBadgeAsync()`
code_samples:
- getbadgeinfoasync
Expand Down Expand Up @@ -355,7 +355,7 @@ methods:

- `Class.BadgeService:CheckUserBadgesAsync()`
- `Class.BadgeService:GetBadgeInfoAsync()`
- `Class.BadgeService:AwardBadge()`
- `Class.BadgeService:AwardBadgeAsync()`
code_samples:
- badges---checking-earned-badges
parameters:
Expand Down