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: Check All Player's Teamcolor

Previous Thread :: Next Thread 
OnlineOne is not online. OnlineOne
Joined: 14 Jul 2011
Total Posts: 1193
21 Apr 2016 04:53 PM
runnersColor = game.Teams:FindFirstChild("Runners").TeamColor

for _, runners in next, game.Players:GetPlayers()--[===[From here, how would I detect their team colors? Not like this. TeamColor(runnersColor)--]===] do


How would I check for the amount of players of a certain teamcolor?


#code "Thanks in advance" -- Online
Report Abuse
Widgeon is not online. Widgeon
Joined: 06 Apr 2012
Total Posts: 106
21 Apr 2016 04:56 PM
Heres some sudo code:

local allPlayers = game.Players:GetChildren()

local Team1 = 0
local Team2 = 0

for A = 1,#allPlayers do
if allPlayers[A].TeamColor == BrickColor.new("Black")
Team1 = Team1 + 1
elseif allPlayers[A].TeamColor == BrickColor.new("White")
Team2 = Team2 + 1
end
end

print(Team1)
print(Team2)
Report Abuse
iJacobness is not online. iJacobness
Joined: 20 Jan 2014
Total Posts: 4944
21 Apr 2016 05:06 PM
pseudo*



r+://393244197r+://393244224r+://393244262
Report Abuse
OnlineOne is not online. OnlineOne
Joined: 14 Jul 2011
Total Posts: 1193
21 Apr 2016 06:06 PM
Thanks for the correction, Jacob. And W, I'll try it.+


#code -- Online
Report Abuse
OnlineOne is not online. OnlineOne
Joined: 14 Jul 2011
Total Posts: 1193
21 Apr 2016 07:20 PM
Here's my actual code. How would you apply it to this?

runnersNum = 0
taggersNum = 0

function checkTeam()--Checks the server's player's team colors and shows amount on each team
for _, runners in next, game.Players:GetPlayers().TeamColor(runnersColor) do
if runners > minRunners then
runnersNum = runners
print(runnersNum .. " taggers in the game")
end
end

for _, taggers in next, game.Players:GetPlayers().TeamColor(runnersColor) do
if taggers > minTaggers then
taggersNum = taggers
print(taggersNum .. " taggers in the game")
end
end
end


#code -- Online
Report Abuse
OnlineOne is not online. OnlineOne
Joined: 14 Jul 2011
Total Posts: 1193
21 Apr 2016 07:21 PM
http://forum.roblox.com/Forum/ShowPost.aspx?PostID=187819164#187836971


#code -- Online
Report Abuse
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
21 Apr 2016 07:50 PM
local function getTeams()
local output = {}
for _, player in next, (game.Players:getPlayers()) do
if (output[player.TeamColor.Name] == nil) then
output[player.TeamColor.Name] = {}
end
table.insert(output[player.TeamColor.Name], player)
end
return (output);
end

local teams = getTeams()

print(#(teams["Bright blue"] or {})) --[[> The number of players whose TeamColor is Bright Blue.]]
Report Abuse
OnlineOne is not online. OnlineOne
Joined: 14 Jul 2011
Total Posts: 1193
24 Apr 2016 10:20 AM
Works! Thanks. Sorry I'm late to respond.


#code -- Online
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