Experience thinks I have the badge when I don't

To make things clear, the badge has been created by me under a group, I have not received any badge awarded message or even my custom message ui. The game just thinks I have it even though it doesn’t appear I do, on the game page or my profile.

local _hasbadge, _error = pcall(BadgeService.UserHasBadgeAsync, BadgeService, Player.UserId, BadgeId)
if _hasbadge then
	print("player alraedy has badge")
	ReplicatedStorage.rreemotes.clientOnly.doEffect:FireClient(Player, "Warn","You already have this achievement! ".._badgeinfo.Name, 10, false)
	return false
end

image

Check your inventory for the badge. If it appears in your inventory, you can delete it from there and then test again. Your script doesn’t seem to have any issues.

Doesn’t appear on my inventory too.
image

Are you checking the right badge id?

The badge id is 3365410290056381 as I learnt from Question about badges - #2 by DonaldDuck5150 or is it the asset id from the creator hub?

In this line of your script:

local _hasbadge, _error = pcall(BadgeService.UserHasBadgeAsync, BadgeService, Player.UserId, BadgeId)

replace with:

local _error, _hasbadge = pcall(BadgeService.UserHasBadgeAsync, BadgeService, Player.UserId, BadgeId)

The first output of a pcall() function is whether or not it ran correctly, which in your case is _error
Just swap the variables!

oh it works now somehow cool
image

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.