My "Welcome" badge isn't being rewarded

Title, very confused as to why this isn’t working.
I checked my inventory and I don’t have the badge. Please help.
Script:

local badgeID = 2148420348
local badgeService = game:GetService("BadgeService")

game.Players.PlayerAdded:Connect(function(player)
	wait(1)
	if not badgeService:UserHasBadge(player.UserId, badgeID) then
		badgeService:AwardBadge(player.UserId, badgeID)
	end
end)
11 Likes
local badgeID = 2148420348
local badgeService = game:GetService("BadgeService")

game.Players.PlayerAdded:Connect(function(player)
	wait(1)
	if not badgeService:UserHasBadgeAsync(player.UserId, badgeID) then
		badgeService:AwardBadge(player.UserId, badgeID)
	end
end) 

Or maybe you have a badge and you didn’t notice.

7 Likes

I double-checked, I don’t have it.

3 Likes

Did it help? If not then double-check badgeId could probably be wrong. Where highlighted is IdBadge. The screen is of my badgeId.
image

3 Likes

See you need to use Server Script in ServerScriptService.

1 Like

Still didn’t work, sorry.
(30 limit)

1 Like

It is a server script in ServerScriptService.

1 Like

That’s weird. It works for me.

1 Like

In Roblox Studio gives me a badge, are you trying through Roblox Studio? Also see if the script is turned off.

1 Like

No I went into the game in Roblox, and no the script is not turned off.

1 Like

Try to get into Test Roblox Studio.

2 Likes

“UserHasBadge” is deprecated, try using “UserHasBadgeAsync” instead.

1 Like

Don`t worked. I gave him a script like this before

1 Like

I tried it, still didn’t work
:skull: :skull: :skull: :skull: :skull: :skull: :skull: :skull: :skull: :skull: :skull: :skull: :skull: :skull: :skull: :skull: :skull: :skull: :skull: :skull: :skull: :skull: :skull: :skull: :skull:

1 Like

Still didn’t work
:skull: :skull: :skull: :skull: :skull: :skull: :skull: :skull: :skull: :skull: :skull: :skull: :skull: :skull: :skull:

1 Like

@GammerAtomYT Join the Test in roblox studio just try it.

2 Likes

what do you mean I tested my game in roblox studio bro I got 5 hours of sleep bro im tired

1 Like

Maybe you just forgot to Publish and tried to get badge in the game. It happens. I’ve been like that all day.

2 Likes

nah b ro i published the game imm fine

1 Like

You should check if your script does run, i have added some print functions to your code so only thing you need to do is just debug the script:

local badgeID = 2148420348
local badgeService = game:GetService("BadgeService")

game.Players.PlayerAdded:Connect(function(player)
	wait(1)
	print("Checking if " ..player.Name.. "has a badge, which id is: " ..badgeID.." ...")
	if not badgeService:UserHasBadgeAsync(player.UserId, badgeID) then
		print("Badge awarded to " ..player.Name.."!")
		badgeService:AwardBadge(player.UserId, badgeID)
	end
end)
3 Likes