So Im Making a game. When u join, you are greeted by a "UGS" which is select the team GUI. So that ahppens when u join the game. But when you join the game, I want the player to join the "Choosing" team. How would I do that!? (the colour for the choosing team is White. The colour for Counter-Terrorists is Really blue. The colour for Terrorists is Deep Orange. See if that's any help) Thanks
Make A Player Join A Team When They Join?
2 answers
So you're wanting to make a script that assigns teams?
Let's start with Services you'll need:
local Players = game: GetService ("Players")
Now, why did I assign Players to the Service Players? I assigned it for simple access and made it so if you were to change the name of the service, it'd still be found.
Now for finding the player.
local Player = Players.LocalPlayer -- This only applies with Local Scripts.
So, we have the player now; now to continue on accessing what team the Player is on. For Player, ROBLOX sets teams through BrickColor.new() which applies with mostly BaseParts. For an example, this is going to set the team to Really red. (A BrickColor.)
Setting Player team to Really red.
local Players = game: GetService ("Players")
local Player = Players.LocalPlayer
Player.TeamColor = BrickColor.new("Really red") -- TeamColor is Cap sensitive.
Now for the rest, such as GUI buttons, I shall link to you. A hint is: http://wiki.roblox.com/index.php?title=Function http://wiki.roblox.com/index.php?title=API:Class/TextButton
For reference of what I used: http://wiki.roblox.com/index.php?title=API:Class/Players http://wiki.roblox.com/index.php?title=API:Class/Player
Additionally, if you wish to ask questions. Directly Message me on ROBLOX.
Best of luck!
This is a relatively simple thing to do. In case you don't already know, characters (the "physical" character you actually see in the game, not the player object in game.Players) have a thing in them called a humanoid. They don't make up the physical structure off the character, but they do store important information, including health, jump power, and, most relevant here, TeamColor. So in a script, whenever a player joins, simply set their team color to white, like so:
--Note: This would be a server script in ServerScriptService
game.Players.PlayerAdded:connect(function(plyr) -- When the player joins...
plyr.Character.TeamColor = BrickColor.new("White") --Set their TeamColor to white
end)
Good luck!
3 comments
TeamColor is a property of Player, not Player.Characer(which is just a Model).
Thanks
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
This is detailed. thanks
Thanks! I attempted to type that all out on a phone- so prompts to me for taking the time! Hopefully you've done well with it! :D