local teams = game:GetService("Teams")
local function checkPlayerTeam(player)
local dummy = game:GetService("StarterPlayer"):WaitForChild("StarterCharacter")
if player.Team == teams["Red"] then
dummy.LeftLowerLeg.BrickColor = BrickColor.Red()
dummy.LeftUpperLeg.BrickColor = BrickColor.Red()
dummy.LowerTorso.BrickColor = BrickColor.Red()
dummy.RightLowerLeg.BrickColor = BrickColor.Red()
dummy.RightUpperLeg.BrickColor = BrickColor.Red()
dummy.UpperTorso.BrickColor = BrickColor.Red()
elseif player.Team == teams["Blue"] then
dummy.LeftLowerLeg.BrickColor = BrickColor.Blue()
dummy.LeftUpperLeg.BrickColor = BrickColor.Blue()
dummy.LowerTorso.BrickColor = BrickColor.Blue()
dummy.RightLowerLeg.BrickColor = BrickColor.Blue()
dummy.RightUpperLeg.BrickColor = BrickColor.Blue()
dummy.UpperTorso.BrickColor = BrickColor.Blue()
end
end
game.Players.PlayerAdded:Connect(checkPlayerTeam)
For changing the brick color it’s gonna need to look something like this workspace.Part.BrickColor = BrickColor.new("Pastel Blue")
i did that but it does not work
and there are no errors so do you have any other idea what it could be?
and by the way the script is a server script inside StarterCharacterScripts
Put a print after each of the if statements to see if it’s passing.
local teams = game:GetService(“Teams”)
local function checkPlayerTeam(player)
local dummy = game:GetService("StarterPlayer"):WaitForChild("StarterCharacter")
if player.Team == teams["Red"] then
print("works #1")
dummy.LeftLowerLeg.BrickColor = BrickColor.new("Really red")
dummy.LeftUpperLeg.BrickColor = BrickColor.new("Really red")
dummy.LowerTorso.BrickColor = BrickColor.new("Really red")
dummy.RightLowerLeg.BrickColor = BrickColor.new("Really red")
dummy.RightUpperLeg.BrickColor = BrickColor.new("Really red")
dummy.UpperTorso.BrickColor = BrickColor.new("Really red")
elseif player.Team == teams["Blue"] then
print("works #2")
dummy.LeftLowerLeg.BrickColor = BrickColor.new("Pastel Blue")
dummy.LeftUpperLeg.BrickColor = BrickColor.new("Pastel Blue")
dummy.LowerTorso.BrickColor = BrickColor.new("Pastel Blue")
dummy.RightLowerLeg.BrickColor = BrickColor.new("Pastel Blue")
dummy.RightUpperLeg.BrickColor = BrickColor.new("Pastel Blue")
dummy.UpperTorso.BrickColor = BrickColor.new("Pastel Blue")
end
end
game.Players.PlayerAdded:Connect(checkPlayerTeam)
print(“works #3”)
like this?**
Yes and run it and tell me if it prints both of those.
Is this a server script? And where is this script placed?
it only prints the (“Works #3”)
That means it’s not passing the first two therefore it’s not changing it’s color. Make sure that the player is on that team or you are defining it right.
it shows in the leaderboard but not in the team section
I believe you are changing the color of the character in “StarterCharacter” and not the character the player spawns with. Maybe disable automatic spawning and spawn them after you change it? or a simpler way, change the color of the player’s avatar, not the starter character.
i can try to make this script wait right? or i put the “StarterCharacter” in serverStorage
and wait(1) and clone it into StarterPlayer
Are you defining the Teams like this? local Teams = game:GetService("Teams")
yes i do it like that is that the problem?
No that’s not. That’s how it should be let me send you a block of code that worked for other people in the past.
Try using CharacterAdded()
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
if player.Team == teams["Red"] then
print("works #1")
Character.LeftLowerLeg.BrickColor = BrickColor.new("Really red")
Character.LeftUpperLeg.BrickColor = BrickColor.new("Really red")
Character.LowerTorso.BrickColor = BrickColor.new("Really red")
Character.RightLowerLeg.BrickColor = BrickColor.new("Really red")
Character.RightUpperLeg.BrickColor = BrickColor.new("Really red")
Character.UpperTorso.BrickColor = BrickColor.new("Really red")
elseif player.Team == teams["Blue"] then
print("works #2")
Character.LeftLowerLeg.BrickColor = BrickColor.new("Pastel Blue")
Character.LeftUpperLeg.BrickColor = BrickColor.new("Pastel Blue")
Character.LowerTorso.BrickColor = BrickColor.new("Pastel Blue")
Character.RightLowerLeg.BrickColor = BrickColor.new("Pastel Blue")
Character.RightUpperLeg.BrickColor = BrickColor.new("Pastel Blue")
Character.UpperTorso.BrickColor = BrickColor.new("Pastel Blue")
end
end)
end)