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

A team's leaderstat?

Is there a way to access a team's leaderstat, such as KOs, instead of a single player's leaderstat?

1 answer

✓ Accepted answer

You could always just go through all of the players leaderstats, and add up the values. Given, that the player is on that certain team of course. Here's an example:

Team="Bright blue"
Plrs=game.Players:GetPlayers()

while wait(1) do --Repeats the process every second
	local TotalKills=0 --Sets the variable to add to
	for i=1,#Plrs do --Cycles through each player
		if Plrs[i].TeamColor=Team then --Finds if the player is on the desired team or not.
			TotalKills=TotalKills+Plrs.leaderstats.Kills.Value --Adds up the teams current kill count
		end
	end
	print("Total kills for "..Team.." team: "..TotalKills) --Prints out the total kills for the team
end

This would work good if you were just trying to print out the kills on a certain team. Anyways, this is just an example, so if you need any more clarification, please leave a comment below. Hope I helped :P

2 comments

0

I edited it to work, so I'll accept it as the answer. Thanks for helping!

0

No prob, glad I could help :P

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