of     1   

Combrad
#36216100Saturday, October 30, 2010 9:10 AM GMT

function randomplayer() Player = game.Players:GetChildren() for i = 1,#Player do Player[i].TeamColor = BrickColor.new("Bright red") wait(0.5) end for i = 1,#Player/2 do c = math.random(1,#Player) Player[c].TeamColor = BrickColor.new("Bright red") wait(0.5) end for i = 1,#Player do Player[i].Character:BreakJoints() end end
bloob827
#36217298Saturday, October 30, 2010 10:43 AM GMT

Did you call the function
bloob827
#36217376Saturday, October 30, 2010 10:50 AM GMT

function randomplayer() Player = game.Players:GetChildren() for i = 1,#Player do Player[i].TeamColor = BrickColor.new("Bright red") wait(0.5) end for i = 1,#Player/2 do c = math.random(1,#Player) Player[c].TeamColor = BrickColor.new("Bright red") wait(0.5) end for i = 1,#Player do Player[i].Character:BreakJoints() end end randomplayer() This should work.
Combrad
#36217413Saturday, October 30, 2010 10:54 AM GMT

Yes I called it. When I tested it...Wait I just noticed... function randomplayer() Player = game.Players:GetChildren() for i = 1,#Player do Player[i].TeamColor = BrickColor.new("Bright red") -- RED wait(0.5) end for i = 1,#Player/2 do c = math.random(1,#Player) Player[c].TeamColor = BrickColor.new("Bright red") -- RED (Should be blue) wait(0.5) end for i = 1,#Player do Player[i].Character:BreakJoints() end end randomplayer()
bloob827
#36217420Saturday, October 30, 2010 10:54 AM GMT

Ahh.. thats why I didn't change teams.
AgentFirefox
Top 100 Poster
#36218553Saturday, October 30, 2010 12:00 PM GMT

function randomplayer() local Player = game.Players:GetChildren() for i = 1,#Player do local r = math.random(1, #Player) local rand = Player[r] if i%2 == 0 then rand.TeamColor = BrickColor.new("Bright red") else rand.TeamColor = BrickColor.new("bright blue") end table.remove(Player, r) end end Now this is truly random, and it guarantees an even team every time. :D
Combrad
#36218755Saturday, October 30, 2010 12:09 PM GMT

Mine got an even team unless a player joined during it.
AgentFirefox
Top 100 Poster
#36218801Saturday, October 30, 2010 12:11 PM GMT

Yeah but the teams weren't random. A person could've been left on his/her team and another person could've changed teams multiple times. My script guarantees even teams. I don't see how yours would guarantee an even team. If you look at the logic behind the script, you'll see what I mean.
Combrad
#36218859Saturday, October 30, 2010 12:14 PM GMT

Well I can see what you mean slightly. But it complete its purpose...
AgentFirefox
Top 100 Poster
#36218893Saturday, October 30, 2010 12:15 PM GMT

With how many players did you test it? I suggest testing with at least 10 players. You'll find that one team has a high chance of having a team being stacked.
AgentFirefox
Top 100 Poster
#36218912Saturday, October 30, 2010 12:16 PM GMT

"You'll find that one team has a high chance of having a team being stacked." Morning brain fail... You'll find that one team has a high chance of being stacked.
Combrad
#36219161Saturday, October 30, 2010 12:25 PM GMT

Agent one other question...I made a script that selects a random player from each team. If I re run that script how can I make it so it DOES NOT select the player that was chosen from the previous run?
AgentFirefox
Top 100 Poster
#36219717Saturday, October 30, 2010 12:44 PM GMT

currentPlayers = { } lastPlayers = { } function ChooseRandomPlayer(Amount, New)         local A = Amount or 1         local N = New or false         local _P = game.Players:GetPlayers()         currentPlayers = { }         for I = 1, A do                 for _ = 1, 1000 do                         local R = math.random(1, #_P)                         if lastPlayers[I] ~= _P[R] then                                 table.remove(_P, R)                                 currentPlayers[I] = _P[R]                                 lastPlayers[I] = _P[R]                                 break                         end                 end         end         return unpack(currentPlayers) end I made the currentPlayers table global for a reason. Same goes with the lastPlayers table.

    of     1