Badge Reward not working


I have a Wins value for each player thats is stored in leaderstats and gets saved in a datastore.

Basically, when the players Wins value is updated, a local script fires a remote event. The Badge rewarder script, when the event is fired, gets the player name so that it can verify that the player actually has that many wins, and to make sure that even if a hacker changes stuff, they won’t get the badge.

Everything is working perfectly, except the fact that the badge is not getting rewarded.

I took a look at the dev documents that Roblox made about badge rewarding, and it doesn’t seem to work in my script…

local BadgeService = game:GetService("BadgeService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local AwardBadgeRE = ReplicatedStorage:WaitForChild("AwardBadge")

local function awardBadge(player, badgeId)
	-- Fetch badge information
	local success, badgeInfo = pcall(function()
		return BadgeService:GetBadgeInfoAsync(badgeId)
	if success then
		-- Confirm that badge can be awarded
		if badgeInfo.IsEnabled then
			-- Award badge
			local awarded, errorMessage = pcall(function()
				BadgeService:AwardBadge(player.UserId, badgeId)
				print("Badge awarded to player.")
			if not awarded then
				warn("Error while awarding badge:", errorMessage)
		warn("Error while fetching badge info!")

function VerifyReward(player)
	local leaderstats = player:FindFirstChild("leaderstats")
	local wins =  leaderstats:FindFirstChild("Wins")
	if wins.Value == 50 then -- 50 BADGE
		print("player can get 50 wins badge.")
		awardBadge(player, 2124893711)

	elseif wins.Value == 100 then -- 100 BADGE
		print("player can get 100 wins badge.")
		awardBadge(player, 2124893712)

	elseif wins.Value == 500 then -- 500 BADGE
		print("player can get 500 wins badge.")
		awardBadge(player, 2124893713)
		warn("Player not eligible for a badge yet.")



Why is this not working?

the line *print(“Badge awarded to player.”) even prints, but the player does not get the badge…

what am I doing wrong?

You should first ensure that you do not actually have the badge already.

It only awards it if you don’t have it. To test it, go to the badge’s page, click the dots, and click “Remote from inventory”

Are you attempting to award the badge from the client through the use of a local script? Because BadgeService:AwardBadge() will only operate if executed by the server.

I don’t have the badge in my inventory…

I am rewarding through a server script. so I don’t know. why it isn’t working.

So I just looked at your script, when calling “AwardBadge()” you need to pass the player’s ID as the first argument to the method, not the player instance.

So swap all occurrences of “player” with “player.UserId”.

They are passing the player variable through to another function they made, called AwardBadge. The function then awards the badge. It also changes the ‘player’ variable to the player.UserId

I see, I just took a quick glance and saw “awardbadge” and “player” without the .UserId indexing (and jumped to the conclusion that they had made the age-old mistake). In that case then either the badges have already been awarded, the badge IDs are incorrect, the badges are disabled or the badge service is/was currently down.

Have you tried running the game in a public server (any server that is not in studio)? From memory you can’t award badges from Studio


Never thought of that.

Yes it worked! Thanks heaps for bring that to my attention.