Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I have a badge that works in Studio but not in the game. Does anyone know how to fix this?

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

0

Badges can't be awarded if the creator of the badge doesn't have it themselfs. Atleast I think so

0

ok but then why can't I get it when I'm not in studio

1 answer

When you earn a badge in studio, it is already earned meaning it can not be earned again.

For example, Getting a Level 10 badge in a game. You can't get Level 10 on the same account.

Hope this helped!

5 comments

0

The thing is, if I disown it can't I get it back? I tried doing that but it didn't work unless I was in studio.

0

Try just deleting the badge and re-doing it in the actual place. If that doesn't work, it could be a scripting error.

0

okay

0

It's a scripting error but what could the error be? When I click play and look in the output there are no warnings and no errors.

0

I dont see a badgeId local. Try doing "local badgeId"?

This discussion is preserved as it was. New answers, comments, and votes are closed.