OnlineOne
|
  |
| Joined: 14 Jul 2011 |
| Total Posts: 1193 |
|
|
| 21 Apr 2016 04:53 PM |
runnersColor = game.Teams:FindFirstChild("Runners").TeamColor
for _, runners in next, game.Players:GetPlayers()--[===[From here, how would I detect their team colors? Not like this. TeamColor(runnersColor)--]===] do
How would I check for the amount of players of a certain teamcolor?
#code "Thanks in advance" -- Online |
|
|
| Report Abuse |
|
|
Widgeon
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 106 |
|
|
| 21 Apr 2016 04:56 PM |
Heres some sudo code:
local allPlayers = game.Players:GetChildren()
local Team1 = 0 local Team2 = 0
for A = 1,#allPlayers do if allPlayers[A].TeamColor == BrickColor.new("Black") Team1 = Team1 + 1 elseif allPlayers[A].TeamColor == BrickColor.new("White") Team2 = Team2 + 1 end end
print(Team1) print(Team2)
|
|
|
| Report Abuse |
|
|
|
| 21 Apr 2016 05:06 PM |
pseudo*
r+://393244197r+://393244224r+://393244262 |
|
|
| Report Abuse |
|
|
OnlineOne
|
  |
| Joined: 14 Jul 2011 |
| Total Posts: 1193 |
|
|
| 21 Apr 2016 06:06 PM |
Thanks for the correction, Jacob. And W, I'll try it.+
#code -- Online |
|
|
| Report Abuse |
|
|
OnlineOne
|
  |
| Joined: 14 Jul 2011 |
| Total Posts: 1193 |
|
|
| 21 Apr 2016 07:20 PM |
Here's my actual code. How would you apply it to this?
runnersNum = 0 taggersNum = 0
function checkTeam()--Checks the server's player's team colors and shows amount on each team for _, runners in next, game.Players:GetPlayers().TeamColor(runnersColor) do if runners > minRunners then runnersNum = runners print(runnersNum .. " taggers in the game") end end for _, taggers in next, game.Players:GetPlayers().TeamColor(runnersColor) do if taggers > minTaggers then taggersNum = taggers print(taggersNum .. " taggers in the game") end end end
#code -- Online |
|
|
| Report Abuse |
|
|
OnlineOne
|
  |
| Joined: 14 Jul 2011 |
| Total Posts: 1193 |
|
|
| 21 Apr 2016 07:21 PM |
http://forum.roblox.com/Forum/ShowPost.aspx?PostID=187819164#187836971
#code -- Online |
|
|
| Report Abuse |
|
|
|
| 21 Apr 2016 07:50 PM |
local function getTeams() local output = {} for _, player in next, (game.Players:getPlayers()) do if (output[player.TeamColor.Name] == nil) then output[player.TeamColor.Name] = {} end table.insert(output[player.TeamColor.Name], player) end return (output); end
local teams = getTeams()
print(#(teams["Bright blue"] or {})) --[[> The number of players whose TeamColor is Bright Blue.]] |
|
|
| Report Abuse |
|
|
OnlineOne
|
  |
| Joined: 14 Jul 2011 |
| Total Posts: 1193 |
|
|
| 24 Apr 2016 10:20 AM |
Works! Thanks. Sorry I'm late to respond.
#code -- Online |
|
|
| Report Abuse |
|
|