|
| 07 Jan 2016 07:51 PM |
How do I put people from one team into another team?
I ᴄᴀɴᴛ ᴅʀᴏᴡɴ ᴍʏ ᴅᴇᴍᴏɴs ᴛʜᴇʏ ᴋɴᴏᴡ ʜᴏᴡ ᴛᴏ sᴡɪᴍ |
|
|
| Report Abuse |
|
|
Link5659
|
  |
| Joined: 04 Jun 2012 |
| Total Posts: 4525 |
|
|
| 07 Jan 2016 07:52 PM |
| game.Players:GetChildren() |
|
|
| Report Abuse |
|
|
|
| 07 Jan 2016 07:55 PM |
The tricky part is that there's already one person on a team called "killers" so I want to exclude him. Or do I choose him after I move everyone to one team
|
|
|
| Report Abuse |
|
|
|
| 07 Jan 2016 07:58 PM |
Does this work?
http://prntscr.com/9ne3b5
I don't have three people to test with.
|
|
|
| Report Abuse |
|
|
Aethex
|
  |
| Joined: 16 Oct 2011 |
| Total Posts: 2193 |
|
|
| 07 Jan 2016 07:58 PM |
local plrs = game.Players:GetPlayers();
for _,plr in pairs(plrs) do
if plr.TeamColor == "TEAM COLOR" then
plr.Team = "NEW TEAM COLOR";
end
end |
|
|
| Report Abuse |
|
|
|
| 07 Jan 2016 07:58 PM |
Iterate through all players Check if player is able to be moved (i.e not on the killers team) If so, set new team color |
|
|
| Report Abuse |
|
|
Aethex
|
  |
| Joined: 16 Oct 2011 |
| Total Posts: 2193 |
|
|
| 07 Jan 2016 08:00 PM |
| Assuming that you put the "TEAM COLOR" and "NEW TEAM COLOR" strings inside of actual color representing values (i.e. BrickColor.new) |
|
|
| Report Abuse |
|
|
Aethex
|
  |
| Joined: 16 Oct 2011 |
| Total Posts: 2193 |
|
|
| 07 Jan 2016 08:01 PM |
@op it looks like it would work, you set it up strangely, though
considering you already have p defined, you could have just done #p instead of game.Players.NumPlayers |
|
|
| Report Abuse |
|
|
Metology
|
  |
| Joined: 06 Oct 2014 |
| Total Posts: 3255 |
|
|
| 07 Jan 2016 08:02 PM |
| U can test with more than one person in studio. Start server, start player, 3 people |
|
|
| Report Abuse |
|
|
| |
|
Link5659
|
  |
| Joined: 04 Jun 2012 |
| Total Posts: 4525 |
|
|
| 07 Jan 2016 08:08 PM |
if plr.team == "Bright yellow" then --code else return end |
|
|
| Report Abuse |
|
|
|
| 07 Jan 2016 08:10 PM |
for Index, Value in next, game.Players:GetPlayers() do if Value.TeamColor ~= game.Teams.killer.TeamColor then Value.TeamColor = game.Teams.Survivors.TeamColor end end |
|
|
| Report Abuse |
|
|
|
| 08 Jan 2016 12:21 AM |
function putallplayerinoneteam() local g = game.Players:GetChildren() for i = 1, #g do if g[i]:IsA("Player")then if g[i].TeamColor == game.Teams.theteamplayersneedtobehere.TeamColor then g[i].TeamColor = BrickColor.new("Bright yellow") --the teams brick color u want players to be placed in g[i]:LoadCharacter() wait() end end end end
#code local s = Instance.new("SelectLOL12345", game.Workspace) print("k") |
|
|
| Report Abuse |
|
|