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


7 comments:

  1. That's a default roblox feature.

    ReplyDelete
  2. I'd suggest putting this in a custom function for easy activation in a game script.

    ReplyDelete
  3. @Liama517 The person means re-sorting. Not having a player be sorted on enter.

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. @BCGames- NeedingHelp is just a newbie. He still looks like the default character they gave you towards when roblox started. So I have a question, did NeedingHelp really send you this question or did you just come up with it?

    ReplyDelete
  6. @Doogy
    When they submit something, they don't need to submit their actually username. I have no idea who submitted this, but they entered the name as 'NeedingHelp'.

    ReplyDelete

Write your comment here... OR Flingi will eat you