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 item is deprecated. Do not use it for new work.
IsLegal returns true if the badge is associated with the current game.
Badges can only be awarded from a place that is part of the game associated with the badge. This means, for example, a developer cannot award a badge associated with another developer’s game.
Note that even if IsLegal returns true, a badge may still not be award-able. For example, it may be disabled. For more information on the criteria for awarding badges see
The badge ID of the badge.
True if the badge is associated with the current game.
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