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: HALP ME!!!! URGENT!

Previous Thread :: Next Thread 
minerioProgramer is not online. minerioProgramer
Joined: 21 Dec 2012
Total Posts: 432
20 Sep 2015 10:27 PM
What line of code would make every player turn into the bright red team, then select one random player, and put him in the bright green team?

Make sure I can insert this line of code in any script that already has stuff in it.
Report Abuse
Vendicular is not online. Vendicular
Joined: 12 Apr 2013
Total Posts: 218
20 Sep 2015 10:30 PM
players = game.Players:GetChildren()

for i = 1, #players do
players[i].TeamColor = BrickColor.new("Bright red")
end

local greenplayer = math.random(1, #players)
players[greenplayer].TeamColor = BrickColor.new("Bright green")
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
20 Sep 2015 10:30 PM
yeah very urgent!11...

local players = game.Players:GetPlayers();
if #players > 0 then
local random = table.remove(players, math.random(#players));
local br = BrickColor.new("Bright red");
local bg = BrickColor.new("Bright green");

random.TeamColor = bg;
for key = 1, #players do
players[key].TeamColor = br;
end
end
Report Abuse
petro180 is online. petro180
Joined: 30 Mar 2009
Total Posts: 354
20 Sep 2015 10:31 PM
local players = game.Players:GetPlayers()
for _, player in pairs(players) do
if player.Character then
player.TeamColor = BrickColor.new("Bright red")
end
end

game.Players[math.random(1, #Players)].TeamColor = BrickColor.new("Bright green")
Report Abuse
minerioProgramer is not online. minerioProgramer
Joined: 21 Dec 2012
Total Posts: 432
20 Sep 2015 10:45 PM
Is it suppose to work in roblox studio?

To test it, i added wait(3)

_________________________________________________________________________
local players = game.Players:GetPlayers();
wait(3)
if #players > 0 then
local random = table.remove(players, math.random(#players));
local br = BrickColor.new("Bright red");
local bg = BrickColor.new("Bright green");
wait(3)
random.TeamColor = bg;
for key = 1, #players do
players[key].TeamColor = br;
end
end
__________________________________________________________________________
in 3 seconds I should become on the red team, then 3 seconds go back to green team.

It did not work...

Why?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
20 Sep 2015 10:46 PM
do 'local players = game.Players:GetPlayers();' after the wait(3)
Report Abuse
minerioProgramer is not online. minerioProgramer
Joined: 21 Dec 2012
Total Posts: 432
20 Sep 2015 10:50 PM
It didn't change );

i waited 3 seconds only to see that my name did not jump to Bright red team
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
20 Sep 2015 10:51 PM
Oh is it neutral? You might have to set that property to false
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