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

Returning the number of players on a team [closed]

Asked by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

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

Locked by youtubemasterWOW and JesseSong

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

2 answers

Log in to vote
0
Answered by
Azarth 3141 Moderation Voter Community Moderator
10 years ago
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)
0
Thanks! Would be easier if you used the script block... Shawnyg 4330 — 10y
Ad
Log in to vote
-1
Answered by 10 years ago
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
0
You copied exactly what he said, just changed the variable... Shawnyg 4330 — 10y
0
I had this before he posted his. Thewsomeguy 448 — 10y
0
I checked the timing, he posted his first. You were about 4-7 mins late.. Shawnyg 4330 — 10y