Sevarm
|
  |
| Joined: 23 Jul 2013 |
| Total Posts: 83 |
|
|
| 18 Nov 2016 11:36 AM |
I can't think of a way on how this script would look so I need help. Thanks.
|
|
|
| Report Abuse |
|
|
helloburp
|
  |
| Joined: 26 Aug 2011 |
| Total Posts: 14376 |
|
|
| 18 Nov 2016 11:39 AM |
| doesn't it automatically do this with 2 spawn points set to different team colors? |
|
|
| Report Abuse |
|
|
|
| 18 Nov 2016 11:42 AM |
Create a game. Create two teams.
Tada!
Otherwise something alike to this:
function doTeam() --get size of team1 --get size of team2 --if team1 > team2 then make player in team 2 --else make player team 1 --end end
onplayerenteredhere doTeam() end
Can't be bothered to write it out properly.
247,231 slices of pizza and counting |
|
|
| Report Abuse |
|
|
Sevarm
|
  |
| Joined: 23 Jul 2013 |
| Total Posts: 83 |
|
|
| 18 Nov 2016 11:47 AM |
Thanks, though I meant like a game script though, like a while true do function, every once in a while, it gets all the players, and splits them into two teams.
|
|
|
| Report Abuse |
|
|
|
| 18 Nov 2016 11:49 AM |
Is it me or did you just answer your own question
247,234 slices of pizza and counting |
|
|
| Report Abuse |
|
|
|
| 18 Nov 2016 11:51 AM |
Just saying. You'll want some Event or Trigger to start the function. Probably won't do much harm but continual while loops seem a bit dodgy.
246,909 slices of pizza and counting |
|
|
| Report Abuse |
|
|
Sevarm
|
  |
| Joined: 23 Jul 2013 |
| Total Posts: 83 |
|
|
| 18 Nov 2016 11:53 AM |
I can't get the last part, the part when it gets all the players, splits them into 2 teams.
|
|
|
| Report Abuse |
|
|
|
| 18 Nov 2016 11:59 AM |
local i = 1 local teamOne = game.Teams.Team1:GetChildren() local teamTwo = game.Teams.Team2:GetChildren()
for index, child in pairs(game.Players:GetChildren()) do if teamOne > teamTwo then child.Team = game.Teams.Team2 else child.Team = game.Teams.Team1 end end
You'll wanna find someway to loop this or have some form of event to trigger this.
Specifics of this code may be incorrect in terms of syntax because my inner beast is a sloth. Hopefully someone on here will point it out if so.
246,918 slices of pizza and counting |
|
|
| Report Abuse |
|
|
|
| 18 Nov 2016 12:00 PM |
Ignore the i. I wrote that while I was thinking about something lol.
247,033 slices of pizza and counting |
|
|
| Report Abuse |
|
|
|
| 18 Nov 2016 12:03 PM |
Here's the function where teams will split (not tested):
function SplitTeams() for i,v in pairs(game.Players:GetChildren()) do if i > ((game.Players:#GetChildren()/2)+1) then v.Team = Team1 --Path to team 1. else v.Team = Team2 --Path to team 2. end end
~MightyDantheman~ |
|
|
| Report Abuse |
|
|
|
| 18 Nov 2016 12:04 PM |
Looks I replied late. Oh well. :P
~MightyDantheman~ |
|
|
| Report Abuse |
|
|
|
| 18 Nov 2016 12:07 PM |
Will probably work in 99% of occassions. But the above might get confusing if players join while the For loop is still running. As you're recreating the table of players.
247,042 slices of pizza and counting |
|
|
| Report Abuse |
|
|
Sevarm
|
  |
| Joined: 23 Jul 2013 |
| Total Posts: 83 |
|
| |
|
|
| 18 Nov 2016 12:09 PM |
It was just meant to be used after each round. :P
~MightyDantheman~ |
|
|
| Report Abuse |
|
|
|
| 18 Nov 2016 12:11 PM |
I'm just saying.
GetChildren() / 2 ) + 1 bit might get a bit confusing, as it might change whilst the for loop is running. I can't be bothered to imagine what effect it'd actually have, probably not much.
247,034 slices of pizza and counting |
|
|
| Report Abuse |
|
|
|
| 18 Nov 2016 12:24 PM |
You wouldn't loop that if you're only using it at the start of each round. You'd simply call the function.
~MightyDantheman~ |
|
|
| Report Abuse |
|
|
|
| 18 Nov 2016 12:38 PM |
Nevermind >.< It was a stretch for me to try and explain something
247,037 slices of pizza and counting |
|
|
| Report Abuse |
|
|