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 » Scripting Helpers
Home Search
 

Perform action if no players on a team

Previous Thread :: Next Thread 
UndeleteTool is not online. UndeleteTool
Joined: 15 Mar 2012
Total Posts: 1851
03 Apr 2013 03:21 AM
I want to perform an action if no players are on a team. I tried this, but as soon as one player changes team it performs the action. How do I only perform the reaction if no one is on the team?

while wait() do
for _,plr in next,game.Players:GetPlayers() do
if plr.TeamColor ~= BrickColor.new("White") then
--do stuff
end
end
end
Report Abuse
UndeleteTool is not online. UndeleteTool
Joined: 15 Mar 2012
Total Posts: 1851
03 Apr 2013 04:27 AM
Anyone?
Report Abuse
UndeleteTool is not online. UndeleteTool
Joined: 15 Mar 2012
Total Posts: 1851
03 Apr 2013 04:48 AM
bomp
Report Abuse
ProjectYeager is not online. ProjectYeager
Joined: 30 Mar 2013
Total Posts: 70
03 Apr 2013 05:10 AM
function GetPlayers(Team)
local Players = game.Players:GetChildren()
local PCount = 0
for i=1,#Players do
if Players[i].TeamColor == Team.TeamColor then
PCount = PCount + 1
end
end
return PCount
end


local People = GetPlayers(game.Teams["Team Name"]) -- Returns players on team
print( People )
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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