rp069
|
  |
| Joined: 22 Apr 2011 |
| Total Posts: 6206 |
|
|
| 31 May 2012 09:31 PM |
i=game.Teams.Azuria:GetChildren()
if [i] = < 3 do game.Workspace.Message.Text = "There must be at least 3 Azuria members for a riad to count!" elseif [i] = > 3 do game.Workspace.Message.Text = "Raids count! don't let them win Azuria!" end end
if it isn't, fixes? |
|
|
| Report Abuse |
|
|
swmaniac
|
  |
| Joined: 28 Jun 2008 |
| Total Posts: 15773 |
|
|
| 31 May 2012 09:33 PM |
I made a function to count the members on a team given the team's color.
function CountOnTeam(TeamColor) local Count = 0 for Index, Player in pairs(game.Players:GetPlayers()) do if Player.TeamColor == TeamColor then Count = Count + 1 end end return Count end |
|
|
| Report Abuse |
|
|
rp069
|
  |
| Joined: 22 Apr 2011 |
| Total Posts: 6206 |
|
|
| 31 May 2012 09:36 PM |
so I would do something like
function CountOnTeam(TeamColor) local Count = 0 for Index, Player in pairs(game.Players:GetPlayers()) do if Player.TeamColor == TeamColor then Count = Count + 1 if Count == > 3 do game.Workspace.Message.Text = "Raids count! don't let them win Azuria!" end if Count == < 3 do game.Workspace.Message.text = "There must be at least 3 Azuria members for a raid to count" end end end return Count end
or am I doing that wrong? |
|
|
| Report Abuse |
|
|
swmaniac
|
  |
| Joined: 28 Jun 2008 |
| Total Posts: 15773 |
|
|
| 31 May 2012 09:37 PM |
if CountOnTeam(BrickColor.new("Team Color here")) =< 3 do game.Workspace.Message.Text = "There must be at least 3 Azuria members for a riad to count!" elseif [i] = > 3 do game.Workspace.Message.Text = "Raids count! don't let them win Azuria!" end end
|
|
|
| Report Abuse |
|
|
rp069
|
  |
| Joined: 22 Apr 2011 |
| Total Posts: 6206 |
|
| |
|
pwnedu46
|
  |
| Joined: 23 May 2009 |
| Total Posts: 7534 |
|
|
| 31 May 2012 09:57 PM |
This would do the same thing as the CountOnTeam function, except without the color specified.
print(#game.Teams.Team:GetChildren())
---------- ~pwnedu46, wiki writer~
|
|
|
| Report Abuse |
|
|
swmaniac
|
  |
| Joined: 28 Jun 2008 |
| Total Posts: 15773 |
|
|
| 01 Jun 2012 06:13 PM |
@pwnedu
I don't think so, the Team objects don't appear to have children, even when players are assigned to them. |
|
|
| Report Abuse |
|
|
thane1326
|
  |
| Joined: 08 Apr 2009 |
| Total Posts: 867 |
|
|
| 01 Jun 2012 06:16 PM |
I dont know if this will work or not but... local children = game.Players:GetChildren() local number = #children |
|
|
| Report Abuse |
|
|