|
| 30 Aug 2015 10:29 PM |
Instead of placing it in just 1 team?
I have a blue team and a red team. I only know how to make it place a player into just the Blue Team. How do I make it also, randomly, place a player on one of the 2 teams instead of just 1?
script.Parent.MouseButton1Down:connect(function() script.Parent.Parent.Parent.Frame.Visible = false script.Parent.Parent.Parent.Announcer.Visible = true wait(3) script.Parent.Parent.Parent.Announcer.Visible = false script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Navy blue") script.Parent.Parent.Parent.Parent.Parent:LoadCharacter()
end)
|
|
|
| Report Abuse |
|
|
|
| 31 Aug 2015 12:02 AM |
Bump
http://www.roblox.com/Revontheous-Final-Form-item?id=289896594 If I didn't have any bad luck, I'd have no luck at all! |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2015 12:11 AM |
local teams = {"Navy blue", "Really red"} --Change 'Really red' to the other team's brick color
script.Parent.MouseButton1Down:connect(function()
local TeamChosen = teams[math.random(1,#teams)]
script.Parent.Parent.Parent.Frame.Visible = false script.Parent.Parent.Parent.Announcer.Visible = true wait(3) script.Parent.Parent.Parent.Announcer.Visible = false script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new(TeamChosen) script.Parent.Parent.Parent.Parent.Parent:LoadCharacter()
end)
"When we say 'Computer,' we mean the Electronic Computer" |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2015 04:01 AM |
Unfortunately, that didn't work. It still spawned many players just on the Blue Team...
Also, is there a Team Balance in there as well?
|
|
|
| Report Abuse |
|
|
OldGoldie
|
  |
| Joined: 17 Aug 2010 |
| Total Posts: 8210 |
|
|
| 31 Aug 2015 04:43 AM |
| All you need to do with teams is check the property, I forget what it is but its like StarterTeam or something. The team with the least players will get put on that team after they join. |
|
|
| Report Abuse |
|
|
| |
|
|
| 31 Aug 2015 12:39 PM |
Well, actually, not autoassignable because 1, first there is a spawn team where all players who join, get sent to that team. Once the round begins, and the player presses 'Play', they get sent to one of the 2 teams... Red or Blue.
Yet, my script only is able to send players to the Blue team and not the Red. |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2015 12:44 PM |
if # blue >= # red then player.team = red else player.team = blue end |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2015 12:53 PM |
You could use modulus like
local players = game.Players:GetPlayers() local teamcolors = {game.Teams.Red.TeamColor,game.Teams.Blue.TeamColor} playersleft = #players while playersleft > 0 do val = playersleft%2 -- using modulus to decide if number is even or odd if val = 0 then players[1].TeamColor = teamcolors[1] elseif val = 1 then players[1].TeamColor = teamcolors[2] end playersleft = playersleft - 1 end
Idk if the above will work but here is a tutorial on modulus that may help by Arbitrayor5 : http://www.roblox.com/Forum/ShowPost.aspx?PostID=45890315
|
|
|
| Report Abuse |
|
|
|
| 31 Aug 2015 12:55 PM |
Sorry did a mistake : local players = game.Players:GetPlayers() local teamcolors = {game.Teams.Red.TeamColor,game.Teams.Blue.TeamColor} playersleft = #players while playersleft > 0 do val = playersleft%2 -- using modulus to decide if number is even or odd if val = 0 then players[1].TeamColor = teamcolors[1] elseif val = 1 then players[1].TeamColor = teamcolors[2] end players[1] = nil end |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2015 01:00 PM |
| Yo just use mine its like not even hard |
|
|
| Report Abuse |
|
|