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 » Scripting Helpers
Home Search
 

Re: Auto change teams

Previous Thread :: Next Thread 
are31 is not online. are31
Joined: 09 Nov 2007
Total Posts: 13767
16 Sep 2013 06:38 PM
if not round then
for _,player in pairs(game.Players:GetPlayers()) do
if player.Character then
player.Character:MoveTo(100,1,100)
a = game:Service("Teams"):GetChildren()
player.Team = a.LobbyTeam
^^^^^^^^^^^^^^^^^^^^^^^^ I know it's super ugly
What I'm trying to do is change the team of the player to the team named lobby team.
Please help, I tried to do it myself before I asked.


(I know there are no ends)
Report Abuse
Soquick is not online. Soquick
Joined: 01 Nov 2012
Total Posts: 1497
16 Sep 2013 06:42 PM
if not round then
for _,player in pairs(game.Players:GetPlayers()) do
if player and player.Character then
player.Character:MoveTo(Vector3.new(100,1,100))
a = game:Service("Teams"):GetTeams()
player.Team = a[math.random(#a)]
Report Abuse
are31 is not online. are31
Joined: 09 Nov 2007
Total Posts: 13767
16 Sep 2013 06:42 PM
But I want it to be the specific team "Lobby" :(
Report Abuse
are31 is not online. are31
Joined: 09 Nov 2007
Total Posts: 13767
16 Sep 2013 06:46 PM
if not round then
for _,player in pairs(game.Players:GetPlayers()) do
if player.Character then
player.Character:MoveTo(100,100,100)
a = game:Service("Teams"):GetTeams()
player.Team = Lobby




fix please
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
16 Sep 2013 06:47 PM
if not round then
for _,player in pairs(game.Players:GetPlayers()) do
if player.Character then
player.Character:MoveTo(100,100,100)
player.TeamColor = game.Teams.Lobby.TeamColor
Report Abuse
Java3D is not online. Java3D
Joined: 29 Jul 2012
Total Posts: 1229
16 Sep 2013 06:48 PM
for n,player in pairs(game.Players:GetPlayers())do
if(player.Character)then
player.Character:MoveTo(Vector3.new(100,100,100))
player.TeamColor = game:GetService("Teams").Lobby.TeamColor
end end


~ 1Topcop
Report Abuse
Soquick is not online. Soquick
Joined: 01 Nov 2012
Total Posts: 1497
16 Sep 2013 06:48 PM
if not round then
for _,player in pairs(game.Players:GetPlayers()) do
if player and player.Character then
player.Character:MoveTo(Vector3.new(100,1,100))
a = game:Service("Teams")
player.TeamColor = a:FindFirstChild("Lobby")
Report Abuse
ZachBloxx is not online. ZachBloxx
Joined: 26 Jun 2013
Total Posts: 2833
16 Sep 2013 06:49 PM
Haven't seen you in a while @Java :P
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
16 Sep 2013 06:51 PM
wops missed the vector thing qq
Report Abuse
Soquick is not online. Soquick
Joined: 01 Nov 2012
Total Posts: 1497
16 Sep 2013 06:51 PM
if not round then
for _,player in pairs(game.Players:GetPlayers()) do
if player and player.Character then
player.Character:MoveTo(Vector3.new(100,1,100))
player.TeamColor = game:GetService("Teams"):FindFirstChild("Lobby").TeamColor
FIX*
Report Abuse
are31 is not online. are31
Joined: 09 Nov 2007
Total Posts: 13767
16 Sep 2013 07:08 PM
crap I meant I wanted the team to change to either Red or Blue team by doing something like this

a = game:Service("Teams"):GetTeams()
player.Team = a[math.random(#a)]


but I wouldn't want there to be a possibility somebody gets on the Lobby team. ^
Report Abuse
are31 is not online. are31
Joined: 09 Nov 2007
Total Posts: 13767
16 Sep 2013 07:14 PM
bump
Report Abuse
Soquick is not online. Soquick
Joined: 01 Nov 2012
Total Posts: 1497
16 Sep 2013 07:14 PM
a = {}
for i,v in pairs(game:Service("Teams"):GetTeams()) do
if v.Name ~= "Lobby" then table.insert(a,#a+1,v)
end end
player.Team = a[math.random(#a)]
Report Abuse
SwaggyAf is not online. SwaggyAf
Joined: 14 Sep 2013
Total Posts: 6556
16 Sep 2013 07:17 PM
can i hold ur dominus on my main plz i wanna look kool
Report Abuse
are31 is not online. are31
Joined: 09 Nov 2007
Total Posts: 13767
16 Sep 2013 07:28 PM
@soquick, it didn't seem to work. look at this:

round = false
if round == false then
wait(5)
for _,player in pairs(game.Players:GetPlayers()) do
if player and player.Character then
player.Character:MoveTo(Vector3.new(1,1,1)) -- teleporting doesn't work either
a = {}
for i,v in pairs(game:Service("Teams"):GetTeams()) do
if v.Name ~= "Lobby" then table.insert(a,#a+1,v)--broken
end end
player.Team = a[math.random(#a)]-- broken
end
end
end
Report Abuse
Java3D is not online. Java3D
Joined: 29 Jul 2012
Total Posts: 1229
16 Sep 2013 07:30 PM
local teams = game:GetService("Teams"):GetTeams()
for n,o in pairs(teams)do if(o.Name=="Lobby")then table.remove(teams,n)end end
for n,o in pairs(game.Players:GetPlayers())do
if(o.Character)then
o.TeamColor = teams[math.random(1,#teams)]
end
end


~ 1Topcop
Report Abuse
Soquick is not online. Soquick
Joined: 01 Nov 2012
Total Posts: 1497
16 Sep 2013 07:41 PM
palyer.TeamColor = a[math.random(#a)].TeamColor
Report Abuse
Java3D is not online. Java3D
Joined: 29 Jul 2012
Total Posts: 1229
16 Sep 2013 07:41 PM
derp. I forgot .TeamColor xP


~ 1Topcop
Report Abuse
Soquick is not online. Soquick
Joined: 01 Nov 2012
Total Posts: 1497
16 Sep 2013 07:44 PM
player*
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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