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: Color 3expected got nil,

Previous Thread :: Next Thread 
SirIngenuity is not online. SirIngenuity
Joined: 06 Oct 2012
Total Posts: 3149
30 Jul 2015 09:56 PM
20:53:09.844 - Workspace.Script:7: bad argument #1 to 'new' (Color3 expected, got nil)
20:53:09.845 - Script 'Workspace.Script', Line 7 - global getPlrsOnTeam
20:53:09.847 - Script 'Workspace.Script', Line 22
20:53:09.849 - Stack End

Im trying to make a script so if players are on bright green team every 8 seconds it says player is on green team

while true do
wait()

function getPlrsOnTeam(teamColor)
local teammates = {}
for i, v in pairs(game.Players:GetPlayers()) do
if v.TeamColor == BrickColor.new(teamColor) then
table.insert(teammates, v)
end
end
return teammates
end

for i, team in pairs(game.Teams:GetChildren()) do
for ii, teammate in pairs(getPlrsOnTeam(team.TeamColor)) do
wait(8)
print(teammate.Name.." is on the "..tostring(team.TeamColor).." team!")
end
end

wait(3)
getPlrsOnTeam()
end
Report Abuse
baldo46 is not online. baldo46
Joined: 28 Jul 2008
Total Posts: 1254
30 Jul 2015 10:03 PM
the way you have it you are setting a BrickColor.new(BrickColor.new(val))...


Change line 7 to

if v.TeamColor == teamColor then
Report Abuse
SirIngenuity is not online. SirIngenuity
Joined: 06 Oct 2012
Total Posts: 3149
30 Jul 2015 10:09 PM
Yay it works

function getPlrsOnTeam(teamColor)
local teammates = {}
for i, v in pairs(game.Players:GetPlayers()) do
if v.TeamColor == teamColor
table.insert(teammates, v)
end
end
return teammates
end

for i, team in pairs(game.Teams:GetChildren()) do
for ii, teammate in pairs(getPlrsOnTeam(team.TeamColor)) do
wait(8)
print(teammate.Name.." is on the "..tostring(team.TeamColor).." team!")
end
end

But now I have new problem how can I make it so does 1 team at time for instance. It will do Bright green teams then next time it will do yellow. How can i have it focus on only doing bright green team.
Report Abuse
SirIngenuity is not online. SirIngenuity
Joined: 06 Oct 2012
Total Posts: 3149
31 Jul 2015 09:31 AM
^
Report Abuse
SirIngenuity is not online. SirIngenuity
Joined: 06 Oct 2012
Total Posts: 3149
31 Jul 2015 09:48 AM
^^
Report Abuse
SirIngenuity is not online. SirIngenuity
Joined: 06 Oct 2012
Total Posts: 3149
31 Jul 2015 10:08 AM
^^^
Report Abuse
SirIngenuity is not online. SirIngenuity
Joined: 06 Oct 2012
Total Posts: 3149
31 Jul 2015 03:31 PM
^^^^
Report Abuse
SirIngenuity is not online. SirIngenuity
Joined: 06 Oct 2012
Total Posts: 3149
31 Jul 2015 04:06 PM
bumpedio
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