Usage example for BadgeService:AwardBadge does not correctly handle failed attempts to award a badge

Issue Description
From what I understand reading the docs and experimenting on my own, BadgeService:AwardBadge() will not error if it fails to award a badge to a player, but return false instead (as it returns a boolean indicating if it was successful or not). Yet, the code sample provided on the page for this function shows using a pcall to check for errors. This will almost always return true, regardless of if the badge was actually awarded, because the function will not error upon a failure to award a badge - it’ll just return false.

The use of a pcall in the code sample is misleading - it may lead readers to assume using one will catch failed attempts, but it will not for most/all scenarios.

Issue Area: DevHub Content
Page URL: BadgeService | Roblox Creator Documentation

5 Likes

Thanks for your report! We’ve triaged the issue and will follow up when it has been resolved.

1 Like

This issue has been resolved! If you are still experiencing the issue, please allow some time for the changes to propagate.

2 Likes

This topic was automatically closed after 24 hours. New replies are no longer allowed.