Saturday, June 11, 2011

Scripting Help 6/11/11

Dear BCG,
How can I make it so my game will evenly sort my teams when a new game starts?
-NeedingHelp

Dear NeedingHelp,
That's simple! First thing to remember is that you need to have a effective method of doing so. For me, that method is using variable change. Here's an example:


Team = 1
TeamColor1 = "Really red" --Change to Team 1's color
TeamColor2 = "Lime green" --Change to Team 2's color
for _,v in pairs(game.Players:GetPlayers()) do
if Team == 1 then
Team = 2
v.TeamColor = BrickColor.new(TeamColor1)
elseif Team == 2 then
Team = 1
v.TeamColor = BrickColor.new(TeamColor2)
end
end