Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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!

This discussion is preserved as it was. New answers, comments, and votes are closed.