|
| 26 Feb 2014 02:43 PM |
So basically I am trying to get all the players, and make one of them a zombie (Bright Green team) Output say's something about a bad interval or something with math.random...
for i,v in pairs(game.Players:GetPlayers()) do wait(4) x = game.Players:GetPlayers() zombie = math.random(1,#x) if v.TeamColor == "Mid gray" then zombie.TeamColor = BrickColor.new("Bright green") end end |
|
|
| Report Abuse |
|
|
ayub32
|
  |
| Joined: 27 Dec 2009 |
| Total Posts: 485 |
|
|
| 26 Feb 2014 02:44 PM |
for i,v in pairs(game.Players:GetPlayers()) do wait(4) zombie = math.random(1,#v) if v.TeamColor == "Mid gray" then zombie.TeamColor = BrickColor.new("Bright green") end end |
|
|
| Report Abuse |
|
|
|
| 26 Feb 2014 02:54 PM |
Nope... This is so annoying idk why this won't work. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 26 Feb 2014 03:31 PM |
"Players:GetPlayers" Is that legit? Just use GetChildren |
|
|
| Report Abuse |
|
|
|
| 26 Feb 2014 03:34 PM |
wait(4) x = game.Players:GetChildren()) zombie = math.random(1,#x)
a = Instance.new("IntValue",zombie) a.Name = "zombie"
for b,v in pairs(x) do if v:findFirstChild("zombie") then v.TeamColor = BrickColor.new("Bright green") end end
--untested
|
|
|
| Report Abuse |
|
|
|
| 26 Feb 2014 03:37 PM |
@maxo Yea it's legit, and I tried :GetChildren() too
|
|
|
| Report Abuse |
|
|
DevDerp
|
  |
| Joined: 25 Jan 2009 |
| Total Posts: 1000 |
|
|
| 26 Feb 2014 03:46 PM |
function ChooseZombiePlayer() x = game.Players:GetChildren() zombie = math.random(1,#x) for i,v in pairs(x) do wait(4)
if i==zombie and v.TeamColor == "Mid gray" then zombie.TeamColor = BrickColor.new("Bright green") end end
end |
|
|
| Report Abuse |
|
|
DevDerp
|
  |
| Joined: 25 Jan 2009 |
| Total Posts: 1000 |
|
|
| 26 Feb 2014 04:17 PM |
function ChooseZombiePlayer() x = game.Players:GetChildren() zombie = math.random(1,game.Players.NumPlayers) for i,v in pairs(x) do wait(4)
if i==zombie and v.TeamColor == "Mid gray" then zombie.TeamColor = BrickColor.new("Bright green") end end
end |
|
|
| Report Abuse |
|
|