| |
|
booing
|
  |
| Joined: 04 May 2009 |
| Total Posts: 6594 |
|
| |
|
| |
|
CWRA0444
|
  |
| Joined: 14 Jan 2010 |
| Total Posts: 6013 |
|
|
| 18 Dec 2016 05:08 PM |
| Just manually assign teams to players on-player-enter(?) |
|
|
| Report Abuse |
|
|
|
| 18 Dec 2016 05:09 PM |
| I want the players to join the team from a gui but limit the team to 1 player only |
|
|
| Report Abuse |
|
|
CWRA0444
|
  |
| Joined: 14 Jan 2010 |
| Total Posts: 6013 |
|
|
| 18 Dec 2016 05:12 PM |
players = game.Players:getPlayers() teams = game.Teams:getTeams() for i = 1, #teams do for i = 1, #players do onTeam = {} if players[i].TeamColor = team[x].TeamColor then table.Insert(onTeam, players[i]) end if #onTeam > 1 then blah blah blah end end end |
|
|
| Report Abuse |
|
|
CWRA0444
|
  |
| Joined: 14 Jan 2010 |
| Total Posts: 6013 |
|
|
| 18 Dec 2016 05:13 PM |
| There are a couple of errors in that code, but that's the idea. You do the math. |
|
|
| Report Abuse |
|
|
| |
|
|
| 18 Dec 2016 05:17 PM |
Did I solve it properly?
players = game.Players:getPlayers() teams = game.Teams:getTeams()
for x = 1, #teams do for i = 1, #players do onTeam = {"Disk Joker"} if players[i].TeamColor == teams[x].TeamColor then table.Insert(onTeam, players[i]) end if #onTeam > 1 then end end end |
|
|
| Report Abuse |
|
|
CWRA0444
|
  |
| Joined: 14 Jan 2010 |
| Total Posts: 6013 |
|
|
| 18 Dec 2016 05:20 PM |
The script I gave you was just a general idea. Here are some tips. Leave onTeam empty, because if theres anything inside onTeam it means theres already a player in that team, in which case you would write code where "blah blah blah" is. Otherwise, the GUI should let the player join the empty team. |
|
|
| Report Abuse |
|
|
CWRA0444
|
  |
| Joined: 14 Jan 2010 |
| Total Posts: 6013 |
|
|
| 18 Dec 2016 05:21 PM |
Wiki article on tables: http://wiki.roblox.com/index.php?title=Table |
|
|
| Report Abuse |
|
|
CWRA0444
|
  |
| Joined: 14 Jan 2010 |
| Total Posts: 6013 |
|
|
| 18 Dec 2016 05:22 PM |
"For" loops: http://wiki.roblox.com/index.php?title=Loops#For |
|
|
| Report Abuse |
|
|
|
| 18 Dec 2016 05:37 PM |
still cant figure it out to mee the loops seems fine and I just cant seem to know where to add the Team to limit it.
players = game.Players:GetPlayers() teams = game.Teams:GetTeams()
for x = 1, #teams do for i = 1, #players do onTeam = {} if players[i].TeamColor == teams[x].TeamColor["Electric blue"] then table.Insert(onTeam, teams[x]) end if onTeam == 1 then print("Hello!") end end end |
|
|
| Report Abuse |
|
|
| |
|
|
| 18 Dec 2016 07:28 PM |
| Im not sure, but i believe if you just make the max amount of players equal to the amount of teams that Roblox itself will balance the teams out. |
|
|
| Report Abuse |
|
|
|
| 18 Dec 2016 07:34 PM |
I want to make a button that would make the player able to join the team but there'd be a limit of 1 player in that team at a time
|
|
|
| Report Abuse |
|
|
| |
|