Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Badge not working?

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)

1 comment

0

Please indent your code correctly

1 answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.