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: 1,000R$ Pay

Previous Thread :: Next Thread 
Yorixk is not online. Yorixk
Joined: 15 Feb 2015
Total Posts: 606
28 Jun 2017 06:07 PM
Paying 1,000 R$ for a block of code which will be placed inside my script to switch players' teams from the "Lobby" team, to the "Red" or "Blue" team.

The teams should also be balanced.

My current code chooses a random map and then teleports users from the "Lobby" team onto the two spawns on the map. The problem is, it randomly spawns the players, which makes the teams unbalanced.

PASTEBIN: /SjvdXnpj


Report Abuse
billybobtijoseph is not online. billybobtijoseph
Joined: 09 Dec 2011
Total Posts: 2163
28 Jun 2017 06:14 PM
local colors={game.Teams.Red.TeamColor, game.Teams.Blue.TeamColor}
for i,v in ipairs(game.Players:GetPlayers())do
if v.TeamColor == game.Teams.Lobby.TeamColor then
v.TeamColor=BrickColor.new(colors[(i-1)%#colors+1])
end
end
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
28 Jun 2017 06:20 PM
local players = game.Players:GetPlayers()
for i=1, #players do
local player = table.remove(players, math.random(#players))
local character = player.Character
if character then
character:MoveTo(spawns[i%#spawns + 1].Position)
end
end
Report Abuse
Yorixk is not online. Yorixk
Joined: 15 Feb 2015
Total Posts: 606
28 Jun 2017 06:32 PM
^ I put your code under mine, or swap yours with mine?



Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
28 Jun 2017 06:33 PM
Swap in.
Report Abuse
Yorixk is not online. Yorixk
Joined: 15 Feb 2015
Total Posts: 606
28 Jun 2017 06:46 PM
16:46:29.247 - ServerScriptService.MainScript:35: attempt to get length of global 'spawns' (a nil value)


Report Abuse
billybobtijoseph is not online. billybobtijoseph
Joined: 09 Dec 2011
Total Posts: 2163
28 Jun 2017 06:47 PM
boi.

You have to put the name and place of ur spawns
Report Abuse
Yorixk is not online. Yorixk
Joined: 15 Feb 2015
Total Posts: 606
28 Jun 2017 06:56 PM
Hm. I just added the new SpawnLocation spawns instead of regular brick spawns, and it broke the system. When you enter the game in the "Lobby" team, you don't spawn on your designated spawn.


Report Abuse
Yorixk is not online. Yorixk
Joined: 15 Feb 2015
Total Posts: 606
28 Jun 2017 06:59 PM
What is causing this? I spawn in the air and not on the "Lobby" spawns, even though I am on the "Lobby" team.


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