How change player team color and name?

Hello, i need change player team color and team name, how could i do that? :scream:

local player = game.Players.LocalPlayer
player.Team = "Guest"
player.TeamColor = BrickColor.new("Really red")

Instead of brick color, try color3

1 Like

player.TeamColor = Color3.new() -- Box of colors should appear, choose which one you like.

I tried it and it didn’t worked :frowning:

local function guestTeamJoin()
	local guestTeam = Instance.new("Team")
	guestTeam.Parent = game:GetService("Teams")
	guestTeam.Name = "Guest"
	
	guestTeam.AutoAssignable = true
	guestTeam.TeamColor = BrickColor.new("Really red")
	
	local player = game.Players.LocalPlayer
	player.Team = "Guest"
	player.TeamColor = Color3.fromRGB(255,0,0)
	

	local guestSpawnLocation = Instance.new("SpawnLocation")
	guestSpawnLocation.Parent = game:GetService("Teams")
	
	guestSpawnLocation.BrickColor = BrickColor.new("Really red")
	guestSpawnLocation.Neutral = true
	guestSpawnLocation.TeamColor = BrickColor.new("Really red")
end

game.Players.PlayerAdded:Connect(guestTeamJoin)

image

I need the player’s team name and color to be the one I created by default

make teams?
if you don’t have Team service yet


https://gyazo.com/8dc659e43cd35977939e7a751b02c08e
here

There’s my team services here

image

image

You can’t access the LocalPlayer via a normal script (server script).
Therefore, the Team you are trying to access is nil.

Local Player works only on the client and local scripts.

If you want to change the TeamColor, use BrickColor.
I am also pretty sure that .Team needs to be set to the Team Object (from team service) and not team name.

Keep in mind that if you change teams from Local Scripts then only you can see the change of the team (and not other players).
When do you change the team (on player join, on button click, on touch)?

Team is a property accessed from the Players tab. Thus, your script should look like this:

game.Players[player.Name].Team = "Team" -- Replace this with your team's name.
game.Players[player.Name].TeamColor = BrickColor.new("Color") -- Replace with your team's brickcolor.
1 Like
local guestTeam = Instance.new("Team")
guestTeam.Parent = game:GetService("Teams")
guestTeam.Name = "Guest"
guestTeam.AutoAssignable = true
guestTeam.TeamColor = BrickColor.new("Really red")

local guestSpawnLocation = Instance.new("SpawnLocation", workspace)
guestSpawnLocation.BrickColor = BrickColor.new("Really red")
guestSpawnLocation.Neutral = true
guestSpawnLocation.TeamColor = guestTeam

local function guestTeamJoin(player)
	player.Team = guestTeam
end

game.Players.PlayerAdded:Connect(guestTeamJoin)

i think it makes new team every time player joins
try this in a server script (in ServerScriptService)

3 Likes

it works but got an error

image

Works! :smiley: thanks you a lot!! :smiley:

local function guestTeamJoin(player)
	local guestTeam = Instance.new("Team")
	guestTeam.Parent = game:GetService("Teams")
	guestTeam.Name = "Guest"

	guestTeam.AutoAssignable = true
	guestTeam.TeamColor = BrickColor.new("Really red")

	player.Team = guestTeam

	local guestSpawnLocation = Instance.new("SpawnLocation")
	guestSpawnLocation.Parent = workspace
	guestSpawnLocation.Parent = game:GetService("Teams")

	guestSpawnLocation.BrickColor = BrickColor.new("Really red")
	guestSpawnLocation.Neutral = true
	guestSpawnLocation.TeamColor = BrickColor.new("Really red")
end

game.Players.PlayerAdded:Connect(guestTeamJoin)
1 Like