|
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|