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
 

Re: Why?

Previous Thread :: Next Thread 
dirk29 is not online. dirk29
Joined: 26 May 2010
Total Posts: 1142
27 Jan 2012 11:41 PM
Why wont this work?
function PlayersIntoTeams(Team1,Team2,TABLE)
Int = 0
for i = 1,#TABLE do
if Int == 0 then
game.Players[TABLE[i]].TeamColor = BrickColor.new(Team1) --22
Int = 1
elseif Int == 1 then
game.Players[TABLE[i]].TeamColor = BrickColor.new(Team2)
Int = 0
end
end
end
What i put
PlayersIntoTeams("Bright blue","Bright red",Players) --Players is a table
Output:
00:39:38 - Workspace.Main:22: bad argument #2 to '?' (string expected, got userdata)
Report Abuse
dirk29 is not online. dirk29
Joined: 26 May 2010
Total Posts: 1142
27 Jan 2012 11:44 PM
Bump
Report Abuse
TheImpersonator is not online. TheImpersonator
Joined: 19 Jul 2011
Total Posts: 111
27 Jan 2012 11:57 PM
Give us line 22 of your script. The error doesn't seem to be in the function looking at the output. Unless the function is at line 22 but there it more code before it? Anyway, could you point out what ever is line 22?
Report Abuse
Legend26 is not online. Legend26
Joined: 08 Sep 2008
Total Posts: 10586
28 Jan 2012 12:01 AM
It's because whatever is in TABLE[i] is the player object itself, not the name of the player.
Report Abuse
NINJAKID09 is not online. NINJAKID09
Joined: 27 Aug 2009
Total Posts: 14392
28 Jan 2012 12:01 AM
Is Players = game.Players:GetChildren() ?
Report Abuse
NINJAKID09 is not online. NINJAKID09
Joined: 27 Aug 2009
Total Posts: 14392
28 Jan 2012 12:02 AM
Basicly I'd say what Legend said, since it'd be the player object.

Try TABLE[i].Name
Report Abuse
Legend26 is not online. Legend26
Joined: 08 Sep 2008
Total Posts: 10586
28 Jan 2012 12:05 AM
Or better, just get rid of indexing the Players object altogether and do TABLE[i].TeamColor = BrickColor.new()
Report Abuse
LuisPambid is not online. LuisPambid
Joined: 31 Mar 2011
Total Posts: 532
28 Jan 2012 03:45 AM
I prefer to use for index, value in pairs(:GetChildren()) do
I know that they're the same but its more easy on coding.
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