I have a badge awarding script in my game that works in Roblox Studio but not in the game. I've checked to make sure that it's active and it is and I've also disowned my badge and tried getting it again but it didn't work. Here's my script,
local BadgeService = game:GetService("BadgeService")
local function awardBadge(player, badgeId)
local success, badgeInfo = pcall(function()
return BadgeService:GetBadgeInfoAsync(badgeId)
end)
if success then
if badgeInfo.IsEnabled then
local awarded, errorMessage = pcall(function()
BadgeService:AwardBadge(player.UserId, badgeId)
end)
if not awarded then
warn("Error while awarding badge", errorMessage)
end
end
else
warn("Error while getting badge info")
end
end

2 comments
Badges can't be awarded if the creator of the badge doesn't have it themselfs. Atleast I think so
ok but then why can't I get it when I'm not in studio