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

How do you find the total value of a leaderboard integer value on a team?

Asked by 7 years ago

I know how to make a team, and I know how to add leaderboard integers, but I am having trouble looking for a way to find the total value of all the players' leaderboard values on 1 team in a script. Is there any value that says this or do I just need to add up all the values up one-by-one?

1 answer

Log in to vote
0
Answered by 7 years ago

I am not sure if there is a more efficient way to do this, but here is how I think it could be done

local count = 0 -- The total number after the loop
for _,v in pairs(Team:GetPlayers()) do -- For each player on the team
    count = count + v.leaderstats.stat.Value -- Adds the amount to "count"
end

Hope this helps!

Ad

Answer this question