Badge script counter I tried to make a script that counts players badges, why does it not work?
Error on line 3
wait(2)
for i,v in pairs (game.Players:GetChildren()) do
if v.userId == plr.PlayerId then
if game:GetService("BadgeService"):UserHasBadge(plr.userId,229929415) then
local stat = v.leaderstats:FindFirstChild("Badge")
if stat ~= nil then
stat.Value = stat.Value + 1
end
elseif game:GetService("BadgeService"):UserHasBadge(plr.userId,229929797) then
local stat = v.leaderstats:FindFirstChild("Badge")
if stat ~= nil then
stat.Value = stat.Value + 1
end
end
end
end
thank you

4 comments
Why are you using "PlayerId"? Also, what is the error in the output?
I tried with userid still not working
You haven't defined the plr variable..
Local plr = plr.parent.parent?