Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
ArCeMo6 -1
4 years ago

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
0
Badges can't be awarded if the creator of the badge doesn't have it themselfs. Atleast I think so MrCatDoggo 213 — 4y
0
ok but then why can't I get it when I'm not in studio ArCeMo6 -1 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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!

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. ArCeMo6 -1 — 4y
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. onforgot 11 — 4y
0
okay ArCeMo6 -1 — 4y
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. ArCeMo6 -1 — 4y
0
I dont see a badgeId local. Try doing "local badgeId"? onforgot 11 — 4y
Ad

Answer this question