Problem with ClickDetector to give a badge

as the title says, I want when a player clicked a ClickDetector with right mouse button, they will get a badge. But it doesn’t seems to work, also there’s no error in the output. Any idea how to fix this?

local Button = script.Parent.ClickDetector

local badgeservice = game:GetService("BadgeService")
local badgeid = (badgeid)

Button.RightMouseClick:Connect(function(plr)
    badgeservice:AwardBadge(plr.UserId, badgeid)
end)

image

2 Likes

Try using MouseClick instead of RightMouseClick

1 Like

still doesn’t work

30 c-h-a-r-a-c-t-e-r-s

Are you testing it on yourself or do you have someone else also helping you test who doesn’t have the badge?

If you’re testing it on yourself you may need to get someone else to test it for you as the owner of the place automatically have the badge owned by default,

If that still doesn’t work, try to see if any one of these is the issue you may be having

1 Like

Check if your enable API services for studio is enabled or not.

1 Like

I’m with my friend, its actually his game and we finally solved it. The problem is because the badge is in the main game and we tested it at the test game.
Also thank you for the help!

2 Likes