Hi guys! Any ideas why this doesn't award the badge? There are no errors. Any help would be appreciated ;) Thanks!
local LeaderboardString = "Coins" local RequiredValue = 1000 local BadgeID = 217045131 game.Players.PlayerAdded:connect(function(Player) local LeaderboardInstance = Player:WaitForChild(LeaderboardString) wait(1) if LeaderboardInstance.Value >= RequiredValue then game:GetService("BadgeService"):AwardBadge(Player.userId, BadgeID) end end)
I'm not sure of how you're organizing your game, but I believe you can't look for "Coins" as a direct child of Player, if you're using a leaderstat.
Thus, this should work:
local LeaderboardString = "Coins" local RequiredValue = 1000 local BadgeID = 217045131 game.Players.PlayerAdded:connect(function(Player) local LeaderboardInstance = Player:WaitForChild('leaderstats'):WaitForChild(LeaderboardString) -- Wait for leaderstats first, then for the LeaderboardString LeaderboardInstance.Changed:connect(function() wait(1) if LeaderboardInstance.Value >= RequiredValue then game:GetService("BadgeService"):AwardBadge(Player.userId, BadgeID) end end) end)
Hope it helps! :) Comment if it doesn't work, and you're using a different scheme.
[EDIT: Added Changed
event]