heirIoom
|
  |
| Joined: 15 Jul 2012 |
| Total Posts: 3775 |
|
|
| 13 Nov 2015 08:22 PM |
Can anyone help me get this working?
a = game.Teams.Blue:GetChildren() while true do wait(1) for i = 1, #a do script.Parent.MainScript.Value = a end end |
|
|
| Report Abuse |
|
|
|
| 13 Nov 2015 08:25 PM |
| comment what your trying to do in it because i have no idea |
|
|
| Report Abuse |
|
|
heirIoom
|
  |
| Joined: 15 Jul 2012 |
| Total Posts: 3775 |
|
|
| 13 Nov 2015 08:31 PM |
| Im trying to get the Number Of Players in the Blue team, (Its named blue), and have that number counted become the value of a IntValue Inside a script. |
|
|
| Report Abuse |
|
|
|
| 13 Nov 2015 08:33 PM |
indent ur damn code
local CountVal = script.Count
function getPlayersOnTeam(color) local count = 0 for _, player in pairs(game.Players:GetPlayers()) do if player.TeamColor == color then count = count + 1 end end return count end
CountVal.Value = getPlayersOnTeam("Really red") |
|
|
| Report Abuse |
|
|
Ben1925
|
  |
| Joined: 07 Apr 2011 |
| Total Posts: 741 |
|
|
| 13 Nov 2015 08:39 PM |
| Use the i variable, not the a variable (Because a contains the table! |
|
|
| Report Abuse |
|
|
heirIoom
|
  |
| Joined: 15 Jul 2012 |
| Total Posts: 3775 |
|
|
| 13 Nov 2015 08:43 PM |
@Chief That same code is in another thread. It doesn't add to the value in any way. |
|
|
| Report Abuse |
|
|
rayk999
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 4705 |
|
|
| 13 Nov 2015 08:44 PM |
| psst, you forgot to make it a BrickColor, you're just comparing the string |
|
|
| Report Abuse |
|
|
|
| 13 Nov 2015 09:28 PM |
"psst, you forgot to make it a BrickColor, you're just comparing the string"
I always pass BrickColor constants. |
|
|
| Report Abuse |
|
|
|
| 13 Nov 2015 09:28 PM |
"That same code is in another thread. It doesn't add to the value in any way. "
well i doubt it's the same code because i wrote it but what is the problem |
|
|
| Report Abuse |
|
|
Jammer622
|
  |
| Joined: 19 Nov 2008 |
| Total Posts: 1739 |
|
|
| 13 Nov 2015 09:42 PM |
function NumTeamPlayers(Team) if not game:GetService("Teams"):FindFirstChild(Team) then return end local Num = 0 for X, P in next, game.Players:GetPlayers() do if P.TeamColor == game:GetService("Teams")[Team].TeamColor then Num = Num + 1 end end return Num end while wait(1) do script.Parent.MainScript.Value = NumTeamPlayers("Blue") end
Does that work for you? <3 |
|
|
| Report Abuse |
|
|
heirIoom
|
  |
| Joined: 15 Jul 2012 |
| Total Posts: 3775 |
|
| |
|