Badge script not working

No errors in output, the goal of the script is to check if a user has a given badge upon joining the game. Any help would be greatly appreciated!

local badge = game:GetService("BadgeService")
local badgeId = 189799329 -- Some badge I own

local Drylands = game.Workspace.Drylands

game.Players.PlayerAdded:connect(function(Player)
	if badge:UserHasBadge(Player.UserId, badgeId) then
		print(Player, "has badge!")
	end
end)

1 Like

Does this script run after some other code or does it run in its own script?

Also, could you show us where the script is located?

1 Like

The script is just inside of workspace and it just runs by itself

Is it a local or normal script?

1 Like

Normal


I’d say try this out

1 Like

userhasbadge is old, use this instead

BadgeService:UserHasBadgeAsync(player.UserId, badgeID)
1 Like

Can you send a screenshot of the script in workspace?

Nevermind, this fixed the issue, I just lacked the necessary braincells to spell “Async” correctly

2 Likes