TeamColor (Property): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Mr Doom Bringer
New page: {| |<onlyinclude>{{Property| name = TeamColor |property = BrickColor ''team color'' |description = Sets the color of the team. |object = [[RBX.lua.SpawnLocation (Object)|SpawnLocation]...
 
>Legend26
Redundant information, looked ugly.
 
(14 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{|
<onlyinclude>{{Property|
|<onlyinclude>{{Property|
name = TeamColor
name = TeamColor
|property = [[BrickColor]] ''team color''
|property = [[BrickColor]] ''teamColor''
|description = Sets the color of the team.
|description = Sets the color of the team.
|object = [[RBX.lua.SpawnLocation (Object)|SpawnLocation]]
|objects = [[RBX.lua.SpawnLocation (Object)|SpawnLocation]], [[RBX.lua.Team (Object)|Team]], [[RBX.lua.Player (Object)|Player]]
|}}</onlyinclude>
|}}</onlyinclude>
|}
 
{{clear floats}}
 
==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 SpawnLocation's TeamColor will be able to spawn there.
 
==In Teams==
A [[Team|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|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 (Property)|TeamColor]] specific to that [[Player]].
<pre>
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 )</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 )