My badge giver script doesn't work for some reason that I can't figure out. What's the problem?
Hello there,
I have a small problem with my badge giver script which gives you a badge when you click it. Everything looks fine, but it doesn't give you any badge when you click it. I'm pretty sure the badge ID is correct (my friends also tried it too) and I get no errors in the output. Where did I do wrong?
Here's the script:
1 | local badgeID = [ theBadgeID ] |
2 | local badgeService = game:GetService( "BadgeService" ) |
3 | script.Parent.ClickDetector.MouseClick:Connect( function (playerWhoClicked) |
4 | if playerWhoClicked.Parent:FindFirstChild( "Humanoid" ) then |
5 | local plr = game.Players:GetPlayerFromCharacter(playerWhoClicked.Parent) |
6 | badgeService:AwardBadge(plr.UserId,badgeID) |