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

How would I get the amount of a team's total kills?

http://wiki.roblox.com/index.php?title=API:Class/Team/Score

This is deprecated, and I'd like to display the total amount of a team's kills on a GUI, so I'm all ears.

8 comments

0

I think a team's score doesn't exist anymore. However, you can get the amount of stats a team has, like kills

0

That's what I literally just asked how to do.

0

Whoops. Not really correctly. What you're going to have to do is insert a value where kills will be added up, and create a script (or modify one) where everytime a person on that team gets a kill, it is added the total team kills.

0

*reading. And I'm not typing correctly either

0

This isn't a request site. W'e're not here to make scripts for you.

0

I do not recall asking you to make a script for me, I do recall implying I needed a method to get a team's total amount of kills. I apologize for your incompetence.

0

OP wasn't requesting a script, he was wondering on how to do something. And I told him how he could do it.

0

You would have to count them as the team kills people. Everytime a player on the team gets a kill, increment a team kill value. Reference said value later on.

1 answer

If you want to get the sum of the kills of every player on a certain team, you can add the number of kills of every player on a certain team together.

function GetKills(teamcolor)
	local kills=0
	for _,v in pairs(game.Players:GetPlayers())do
		if v.TeamColor==teamcolor then
			local l=v:FindFirstChild("leaderstats")
			if l then
				local k=l:FindFirstChild("Kills")
				if k then
					kills=kills+k.Value
				end
			end
		end
	end
	return kills
end

1 comment

0

where is the team color there must I enter the team color?

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