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

How to make a badge counter?

Asked by 8 years ago

I tried to make a script in a textlabel (Gui) that counts the badges a player have of the game. Each time a player have an new badge the counting gets up. Why is this not working?

Btw this are 3 badges of 120 in one game My plan was that a player saw how many badges he\she had like "(12) of 120 badges founded" But only the 12 had to change each time sonone found one more it checks every 2 seconds if he/she have found a new one and then the 12 changes to 13.

b = game:GetService("BadgeService")
while wait (2) do
    if b:UserHasBadge(script.Parent.Parent.Parent.Parent.Parent.userId, 181292701) then
    script.Parent.Text=(tonumber(script.Parent.Text))+1
    elseif b:UserHasBadge(script.Parent.Parent.Parent.Parent.Parent.userId, 181292740) then
    script.Parent.Text=(tonumber(script.Parent.Text))+1
    elseif b:UserHasBadge(script.Parent.Parent.Parent.Parent.Parent.userId, 181292793) then
    script.Parent.Text=(tonumber(script.Parent.Text))+1
    end
end

thank you

0
Use tonumber to change whatever is in the quotes to a number. i.e.; script.Parent.Text=(tonumber(script.Parent.Text))+1 SimplyRekt 413 — 8y

Answer this question