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: Random Team Scramble

Previous Thread :: Next Thread 
FailzStrat is not online. FailzStrat
Joined: 22 Dec 2012
Total Posts: 71
20 Jan 2014 12:25 PM
I'm making a TDJ (Team DeathMatch Juggernaut) And The whole game is based on a GUI. How would I randomly scramble players onto teams and then teleport them all to one position then random ones?
Not troll, sorry for such a big question,
FailzStrat
Report Abuse
secretidagent is not online. secretidagent
Joined: 07 Nov 2010
Total Posts: 1600
20 Jan 2014 12:37 PM
p=game.Players:GetChildren()
for i=1,#p do
n=math.random(1,2)
if n == 1 then
p[i].TeamColor = BrickColor.new("Bright red").Color
elseif n== 2 then
p[i].TeamColor = BrickColor.new("Navy blue").Color
end
end
game.Teams:RebalanceTeams()

Report Abuse
secretidagent is not online. secretidagent
Joined: 07 Nov 2010
Total Posts: 1600
20 Jan 2014 12:45 PM
p=game.Players:GetChildren()
for i=1,#p do
n=math.random(1,2)
if n == 1 then
p[i].TeamColor = BrickColor.new("Bright red").Color
elseif n== 2 then
p[i].TeamColor = BrickColor.new("Navy blue").Color
end
end
for i=1, #p do
if p[i].TeamColor == BrickColor.new("Bright red").Color then
p[i].Character:MoveTo(game.Workspace.PARTNAME.Position)
elseif p[i].TeamColor == BrickColor.new("Navy blue").Color then
p[i].Character:MoveTo(game.Workspace.PARTNAME.Position)
end
end
game.Teams:RebalanceTeams()
Report Abuse
FailzStrat is not online. FailzStrat
Joined: 22 Dec 2012
Total Posts: 71
20 Jan 2014 01:48 PM
--Settings:
generalroundtime = 300 --round duration (5 minutes)
intermissiontime = 30 --seconds between rounds
mapsource = game.ServerStorage.Maps --Documents the location of the maps
--End Settings
-----DO NOT EDIT ANYTHING BELOW--------
maps = {} --LEAVE EMPTY, if you put a map name it increases the chances of that map getting selected.
getmaps = mapsource:GetChildren() --Gets the Maps from ServerStorage.Maps
for i=1,#getmaps do --For every map
maps[#maps+1] = getmaps[i] --get how many maps are in the table maps and add the map names into it
--this makes all the maps be in the table automatically for you
end

function choosemap()
selectmap = math.random(1,#maps)
if selectmap ~= nil then
print(selectmap)
m=Instance.new("Message",Workspace)
m.Text = "This rounds map is:".. selectmap
wait(3)
m:remove()
mapname = maps[selectmap]
print(mapname)
realmap = mapsource[tostring(mapname)]
clonemap = realmap:Clone()
clonemap.Parent = game.Workspace
--clonemap2 = game.Workspace[realmap.Name]
end
end

while true do
wait(30)
choosemap()
wait(300) --5 minutes
m=Instance.new("Message",Workspace)
m.Text = "Round over."
wait(4)
m:remove()
end

end
game.Teams:RebalanceTeams()
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