How do I get a badge to be awarded UGC?

I would like to know how to grant UGC when I get a badge.

I have looked at various topics and it says that I need to get help from a roblox administrator.
I don’t know much about roblox and not much at all about the administrators, so if you could tell me, that would be very helpful!

(I am using a translator so the text may be wrong)

1 Like
if hasBadge then
-- your logic here to give someone the ugc
local BS = game:GetService("BadgeService")
BadgeService.CheckHasBadge = function(player: Player, badgeId)
    local success, hasBadge = pcall(function()
        return BS:UserHasBadgeAsync(player.UserId, badgeId)
    end)

    if not success then
        warn("Error while checking for badge with id: "..badgeId)
    end

    if hasBadge then
        print(player.Name, "has badge", badgeId)
        return
    end
end

you can also use the roblox documentation and read about ugcs in game and badges

1 Like