Rewarding players, with a certain amount of wins, a badge

Hello.
In my game when you reach the top of a tower 50, 100, or 500 times, you win a badge respectively.

The wins are stored in the players leaderstats and get saved on a datastore.

How would I go about rewarding a player when they reach a certain amount of wins?

Using the Instance:GetPropertyChangedSignal() method, you can detect whenever the Value property of their “Wins” leaderstat changes.

If that is connected to a function, a conditional statement could be utilized in order to check if a player has exceeded one of those win thresholds (50, 100, or 500) and a badge could be awarded using BadgeService:AwardBadge().

I’d also recommend checking if the user already owns the badge with BadgeService:UserHasBadgeAsync() to make sure you aren’t trying to award badges they already own each time they win.

1 Like

If the “Wins” leaderstat is an IntValue instance you should use the .Changed event, not the GetPropertyChangedSignal() instance method on its “Value” property.