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: Can you limit the amount of player's allowed on a team?

Previous Thread :: Next Thread 
sgtbubbles8 is not online. sgtbubbles8
Joined: 14 Feb 2012
Total Posts: 2231
29 May 2012 06:18 PM
can you?
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
29 May 2012 06:26 PM
Sure.

Loop through the Players service and count the number of people on a team.

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

if CountOnTeam(BrickColor.new("Really red")) > 5 then
--Do stuff.
end
Report Abuse
Flurite is not online. Flurite
Joined: 03 Apr 2011
Total Posts: 5386
29 May 2012 06:52 PM
Imo, an easier way to do it is to use the PlayerAdded or ChildAdded event to check if that breeches the max number you want.
Report Abuse
sgtbubbles8 is not online. sgtbubbles8
Joined: 14 Feb 2012
Total Posts: 2231
31 May 2012 08:28 PM
thank's
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