generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Bring people to one team

Previous Thread :: Next Thread 
SatanicAffliction is not online. SatanicAffliction
Joined: 23 May 2015
Total Posts: 19
07 Jan 2016 07:51 PM
How do I put people from one team into another team?


I ᴄᴀɴᴛ ᴅʀᴏᴡɴ ᴍʏ ᴅᴇᴍᴏɴs ᴛʜᴇʏ ᴋɴᴏᴡ ʜᴏᴡ ᴛᴏ sᴡɪᴍ
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
07 Jan 2016 07:52 PM
game.Players:GetChildren()
Report Abuse
SatanicAffliction is not online. SatanicAffliction
Joined: 23 May 2015
Total Posts: 19
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
SatanicAffliction is not online. SatanicAffliction
Joined: 23 May 2015
Total Posts: 19
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 is not online. 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
LongKillKreations is not online. LongKillKreations
Joined: 14 Feb 2014
Total Posts: 4502
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 is not online. 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 is not online. 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 is not online. 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
Malic23iousVir534s23 is not online. Malic23iousVir534s23
Joined: 01 Feb 2013
Total Posts: 9
07 Jan 2016 08:03 PM
if not ply then
end
Report Abuse
Link5659 is not online. 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
DivinePheonix is not online. DivinePheonix
Joined: 30 Mar 2011
Total Posts: 11190
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
SelectLOL12345 is not online. SelectLOL12345
Joined: 24 Oct 2012
Total Posts: 517
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image