Need help with badge script

I am trying to make it so when you collect all 25 candies you get a badge. This script is supposed to make the badge part happen. The game is counting the candy in the leaderboard as it should be. But it won’t give me the badge still. Any clue what I am missing?

1 Like

This is how I would do it:

points.Changed:Connect(function()
   if points.Value >= 25 then
      badgeserv:AwardBadge(player.UserId, bid)
   end
end)

EDIT: And if you really want to use a pcall then you can do:

points.Changed:Connect(function()
   if points.Value >= 25 then
      local success,err = pcall(function() badgeserv:AwardBadge(player.UserId, bid) end)
   end
end)
1 Like

okay thanks ill go try this in a few

Thanks so much for your help! It worked!