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

Returning the number of players on a team

Could somebody possibly edit this script to return the number?

a = game.Players:GetChildren()
for i,v in pairs(a) do
if a.TeamColor == BrickColor.new("Really red") then
--What would I add here?
end
end

2 answers

✓ Accepted answer
local red = 0 
for i,v in pairs(game.Players:GetPlayers()) do
	if a.TeamColor == BrickColor.new("Really red") then
		red = red + 1
	end
end
print(red)

1 comment

0

Thanks! Would be easier if you used the script block...

a = game.Players:GetChildren()
t = 0
for i,v in pairs(a) do
	if a.TeamColor == BrickColor.new("Really red") then
		t = t+1
	end
end

3 comments

0

You copied exactly what he said, just changed the variable...

0

I had this before he posted his.

0

I checked the timing, he posted his first. You were about 4-7 mins late..

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