TeamColor (Property): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>BlueTaslem
No edit summary
>Legend26
Redundant information, looked ugly.
 
(9 intermediate revisions by 5 users not shown)
Line 1: Line 1:
The TeamColor property are a member of [[Player|Player]], [[Team|Team]], and [[SpawnLocation|SpawnLocation]] objects.
<onlyinclude>{{Property|
TeamColor is a BrickColor value for all three objects.
name = TeamColor
|property = [[BrickColor]] ''teamColor''
|description = Sets the color of the team.
|objects = [[RBX.lua.SpawnLocation (Object)|SpawnLocation]], [[RBX.lua.Team (Object)|Team]], [[RBX.lua.Player (Object)|Player]]
|}}</onlyinclude>
 
{{clear floats}}


==In SpawnLocations==
==In SpawnLocations==
If the [[Neutral|Neutral]] property of the [[SpawnLocation|SpawnLocation]] is not set as true, then only players with the same TeamColor as the SpawnLocatoin's TeamColor will be able to spawn there.
If the [[Neutral|Neutral]] property of the [[SpawnLocation|SpawnLocation]] is not set as true, then only players with the same TeamColor as the SpawnLocation's TeamColor will be able to spawn there.


==In Teams==
==In Teams==
Line 12: Line 18:




{|
{{Example|Here's a [[Script]] that, when a [[Player]] enters the game, creates a new [[Team]], a new [[SpawnLocation]], and a new [[TeamColor (Property)|TeamColor]] specific to that [[Player]].
|<onlyinclude>{{Property|
<pre>
name = TeamColor
function onPlayerAdded( player )
|property = [[BrickColor]] ''team color''
  local playerTeam = Instance.new( "Team", game:GetService( "Teams" ) )
|description = Sets the color of the team.
  playerTeam.Name = player.Name
|object = [[RBX.lua.SpawnLocation (Object)|SpawnLocation]], [[Rbx.lua.Team (Object)|Team]], and [[Rbx.lua.Player (Object)|Player]]
 
|}}</onlyinclude>
  local TeamColor = BrickColor.Random()
|}
 
  player.Neutral = false
  player.TeamColor = TeamColor
  playerTeam.TeamColor = TeamColor
 
  local playerSpawn = Instance.new( "SpawnLocation", Workspace )
  playerSpawn.Position = Vector3.new( math.random( -300, 300 ), math.random( -300, 300 ), math.random( -300, 300 ) )
  playerSpawn.Neutral = false
  playerSpawn.TeamColor = TeamColor
end
 
game.Players.PlayerAdded:connect( onPlayerAdded )</pre>}}
 
[[Category:Properties]]

Latest revision as of 21:30, 21 December 2011

TeamColor
Property BrickColor teamColor
Description Sets the color of the team.
Member of SpawnLocation, Team, Player


In SpawnLocations

If the Neutral property of the SpawnLocation is not set as true, then only players with the same TeamColor as the SpawnLocation's TeamColor will be able to spawn there.

In Teams

A Team's most important value is it's TeamColor, which decides the color of the Team. A Player with the same TeamColor as a Team will appear in the list of players on that team, and have their name shown in that color in the chat list.

In Players

If the Neutral property of the Player is not set as true, then the player will spawn only at SpawnLocations with the same TeamColor as they have. If the TeamColor of the Player does not match any existing Team in the Teams Service, then the player will NOT show up in the leaderboard, and their name will appear as black in the chat area.


Example
Here's a Script that, when a Player enters the game, creates a new Team, a new SpawnLocation, and a new TeamColor specific to that Player.
function onPlayerAdded( player )
   local playerTeam = Instance.new( "Team", game:GetService( "Teams" ) )
   playerTeam.Name = player.Name

   local TeamColor = BrickColor.Random()

   player.Neutral = false
   player.TeamColor = TeamColor
   playerTeam.TeamColor = TeamColor
   
   local playerSpawn = Instance.new( "SpawnLocation", Workspace )
   playerSpawn.Position = Vector3.new( math.random( -300, 300 ), math.random( -300, 300 ), math.random( -300, 300 ) )
   playerSpawn.Neutral = false
   playerSpawn.TeamColor = TeamColor
end

game.Players.PlayerAdded:connect( onPlayerAdded )