coolmatt3
|
  |
| Joined: 12 Jul 2010 |
| Total Posts: 778 |
|
|
| 24 Nov 2015 09:12 PM |
| When players are placed in teams how can a script detect how many players are in that team? I'm trying to create a script that detects when a team gets empty. So Red or Blue team can win and the round can end and it can go to Intermission. |
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
|
| 24 Nov 2015 09:13 PM |
local teamcolor_to_count = BrickColor.new("Bright red") local redpeople = 0
for i,v in pairs(game.Players:GetPlayers()) do if v.TeamColor == teamcolor_to_count then redpeople = redpeople + 1 end end |
|
|
| Report Abuse |
|
|
coolmatt3
|
  |
| Joined: 12 Jul 2010 |
| Total Posts: 778 |
|
|
| 24 Nov 2015 09:15 PM |
| what exactly does that do? |
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
|
| 24 Nov 2015 09:16 PM |
If a player has the teamcolor 'bright red' + 1 will be added to the variable 'redpeople'
this code counts every red person. |
|
|
| Report Abuse |
|
|
coolmatt3
|
  |
| Joined: 12 Jul 2010 |
| Total Posts: 778 |
|
|
| 24 Nov 2015 09:18 PM |
| And how can I make it check when there are 0 red people or blue during a "match" and then ends it if there are 0 in either team |
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
|
| 24 Nov 2015 09:20 PM |
I'd recommend checking out the roblox wiki as it contains fresh new content for beginner programmers. You seem kinda new.
But,
if redpeople == 0 then print'no more red people exist' end |
|
|
| Report Abuse |
|
|
coolmatt3
|
  |
| Joined: 12 Jul 2010 |
| Total Posts: 778 |
|
| |
|