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: What's wrong with this team script?

Previous Thread :: Next Thread 
enzo90 is not online. enzo90
Joined: 25 Mar 2012
Total Posts: 7104
17 Jun 2014 11:45 AM
--I'm trying to get one player on the team bright blue whilst all others are on bright green.
Output:
12:34:48.027 - Workspace.Script:6: '=' expected near 'blue'
--creating teams
local Spawn = Instance.new("Team", Game:GetService("Teams"))
Spawn.Name = tostring(game.Workspace.SpawnLocation1.BrickColor)--Bright blue
Spawn.TeamColor = tostring(game.Workspace.SpawnLocation1.BrickColor)
Bright blue=game.Teams.Autoassignable=false

local Spawn = Instance.new("Team", Game:GetService("Teams"))
Spawn.Name = tostring(game.Workspace.SpawnLocation.BrickColor)
Spawn.TeamColor = game.Workspace.SpawnLocation.BrickColor
wait (.5)
--Assigning teams
function random()
players = game.Players:GetPlayers()
player = players[math.random(1,#players)]
player.TeamColor = "Bright green"
end
Report Abuse
SenseiWarrior is not online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
17 Jun 2014 11:46 AM
Bright blue=game.Teams.Autoassignable=false

You cant have 2 ='s in the same line like that. Change that to this;

game.Teams["Bright blue"].Autoassignable = false
Report Abuse
enzo90 is not online. enzo90
Joined: 25 Mar 2012
Total Posts: 7104
17 Jun 2014 12:32 PM
Workspace.Script:5: bad argument #3 to 'TeamColor' (BrickColor expected, got string)
Report Abuse
enzo90 is not online. enzo90
Joined: 25 Mar 2012
Total Posts: 7104
17 Jun 2014 12:49 PM
Output:
Workspace.Script:6: bad argument #3 to 'TeamColor' (BrickColor expected, got string)

--creating teams
local Spawn = Instance.new("Team", Game:GetService("Teams"))
Spawn.Name = "Bright blue"--Bright blue
Spawn.TeamColor = "Bright blue"--Here is the error according to output
game.Teams["Bright blue"].Autoassignable = false

local Spawn = Instance.new("Team", Game:GetService("Teams"))
Spawn.Name = "Bright green"--Bright green
Spawn.TeamColor = "Bright green"--Bright green
wait (.5)
--Assigning teams C:
for i,v in pairs(Game.Players:GetPlayers()) do
v.TeamColor="Bright green"--Assigns player to bright green
end
local random = game.Players:GetPlayers ()[math.random (1,game.Players.NumPlayers)]
random.TeamColor="Bright blue"--Assigns random player to bright blue


Report Abuse
SenseiWarrior is not online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
17 Jun 2014 12:50 PM
Spawn.TeamColor.Name = "Bright blue" --use .Name
Report Abuse
enzo90 is not online. enzo90
Joined: 25 Mar 2012
Total Posts: 7104
17 Jun 2014 12:55 PM
12:53:40.450 - Name cannot be assigned to
12:53:40.451 - Script 'Workspace.Script', Line 6
12:53:40.451 - Stack End
Report Abuse
enzo90 is not online. enzo90
Joined: 25 Mar 2012
Total Posts: 7104
17 Jun 2014 12:58 PM
This gets so frustrating...
Report Abuse
enzo90 is not online. enzo90
Joined: 25 Mar 2012
Total Posts: 7104
17 Jun 2014 01:00 PM
Here's what I have for getting the teams
local Spawn = Instance.new("Team", Game:GetService("Teams"))
Spawn.Name = "Bright blue"--Bright blue
Spawn.TeamColor.Name = "Bright blue" --use .Name
game.Teams["Bright blue"].Autoassignable = false

local Spawn2 = Instance.new("Team", Game:GetService("Teams"))--[[I changed it to spawn 2, in case the script got confused since I believe it can still access data from the Spawn above it]]
Spawn2.Name = "Bright green"--Bright green
Spawn2.TeamColor.Name = "Bright green"--use .Name
Report Abuse
enzo90 is not online. enzo90
Joined: 25 Mar 2012
Total Posts: 7104
17 Jun 2014 01:01 PM
What the heck...now there is only one team.
Report Abuse
SenseiWarrior is not online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
17 Jun 2014 01:02 PM
Oh wait, .Name is used for if then statements, use Spawn.TeamColor = BrickColor.new("Bright blue")
Report Abuse
enzo90 is not online. enzo90
Joined: 25 Mar 2012
Total Posts: 7104
17 Jun 2014 01:05 PM
Output:Autoassignable is not a valid member of Team

What the heck...and only "Bright blue" team is appearing, likely because I have break on error checked.
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