Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Badge not working?

Asked by 8 years ago

Hi guys! Any ideas why this badge is not working? Thanks!

leaderstat = "Coins" 
amount = 10000 
badgeID = 2170455021 

game['Players'].PlayerAdded:connect(function(player) 
         repeat wait() until player:findFirstChild([[leaderstats]]) 
if player['leaderstats'][leaderstat].Value >= amount then 
         game['BadgeService']:AwardBadge(player.userId, badgeID) 
end end)
0
Please indent your code correctly Validark 1580 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago
local LeaderboardString = "Coins"
local RequiredValue = 10000
local BadgeID = 2170455021

Game.Players.PlayerAdded:connect(function(Player)
    local LeaderboardInstance = Player:WaitForChild(LeaderboardString)
    if LeaderboardInstance.Value >= RequiredValue then
        Game:GetService("BadgeService"):AwardBadge(Player.userId, BadgeID)
    end
end)
Ad

Answer this question