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

How to make badge counter?

Asked by 8 years ago

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

1
Why are you using "PlayerId"? Also, what is the error in the output? jjwood1600 215 — 8y
0
I tried with userid still not working minetrackmania 186 — 8y
1
You haven't defined the plr variable.. Shawnyg 4330 — 8y
0
Local plr = plr.parent.parent? minetrackmania 186 — 8y

Answer this question