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: Help! Quite confused

Previous Thread :: Next Thread 
IceOrb is not online. IceOrb
Joined: 02 May 2010
Total Posts: 1206
06 Jun 2013 09:43 AM
Hey there, my team function balance is quite messed up in other words lol. I got advised to use math.random so that it doesn't keep sorting players into the exact same blue team and red team. WIth a few tips from what he said, I attempted it myself but I think I've done quite a majority of it wrong.

Here is the code:

function randomiseteam()
thePlayers = game.Players:GetPlayers(math.random)
for i, v in pairs(1, #thePlayers) do
if v.TeamColor ~= BrickColor.new("Lavender") then
if i % 2 == 0 then
v.TeamColor = BrickColor.new("Bright red")
else
v.TeamColor = BrickColor.new("Bright blue")
end
v:LoadCharacter()
end
end
end

Any help would be very much appreciated, still learning myself!
Report Abuse
IceOrb is not online. IceOrb
Joined: 02 May 2010
Total Posts: 1206
06 Jun 2013 09:58 AM
Here is the original script:

function randomiseteam()
for i, v in pairs( Game.Players:GetPlayers( ) ) do
if v.TeamColor ~= BrickColor.new("Lavender") then
if i % 2 == 0 then
v.TeamColor = BrickColor.new( "Bright red" )
else
v.TeamColor = BrickColor.new( "Bright blue" )
end
v:LoadCharacter()
end
end
end

Any help?
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