Is their anyway make this checking every 2 seconds, because now it only counts when an player joins but I have over 150 badges so when an player find a new one i want the value goes up but now it doesn't check agian each 2 seconds. Someone know how? Btw I do like to not change line 2 beacuse I already did put in the orginal one 150 badges. Thanks alot!
local BadgeService = game:GetService("BadgeService")
local badges = {229929415, 229929797, 229929912}
while true do
wait (2)
local function countBadges(player)
local numBadges = 0
for _, badge in next, badges do
if BadgeService:UserHasBadge(player.userId, badge) then
numBadges = numBadges + 1
end
end
return numBadges
end
game.Players.PlayerAdded:connect(function(player)
local stats = player:WaitForChild("leaderstats")
local cash = stats:WaitForChild("Badge")
cash.Value = countBadges(player)
end)
end

3 comments
You're such an hero.
An hero, I gotcha.
Just take everything out of the "While true do" except the wait and a call to countBadges.