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.
This function is deprecated. Do not use it for new work. Instead, it can be checked by calling BadgeService:GetBadgeInfoAsync() and checking the IsEnabled field.
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
BadgeService/AwardBadge|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
BadgeService/AwardBadge|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.
The ID of the badge.
True if the specified badge is not available to be awarded.
Awarding a Badge
This code sample includes a simple function for awarding a badge.
local BadgeService = game:GetService("BadgeService") local function awardBadge(player, badgeId) -- check badge can be awarded if BadgeService:IsLegal(badgeId) and not BadgeService:IsDisabled(badgeId) then -- award badge BadgeService:AwardBadge(player.UserId, badgeId) end end
[Deprecated] Checking if a Badge is Disabled
If the below were to be ran in offline mode, it would print
Sorry, badges can only be tested if they are disabled on Roblox game
However, if ran in online mode, it would print true/false to the in-game output in the escape menu (or similar).