generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Question?

Previous Thread :: Next Thread 
coolmatt3 is not online. 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 is not online. 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 is not online. coolmatt3
Joined: 12 Jul 2010
Total Posts: 778
24 Nov 2015 09:15 PM
what exactly does that do?
Report Abuse
62GB is not online. 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 is not online. 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 is not online. 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 is not online. coolmatt3
Joined: 12 Jul 2010
Total Posts: 778
24 Nov 2015 09:22 PM
Okay, very helpful
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image