My goal is so that when the player respawns they are uniformed. Unfortunately, that isn't working..
local home;
local away;
function GetHome() -- To find the hometeam
for i, v in pairs(game.Teams:GetChildren()) do
if v:findFirstChild("home") then
return v
end
end
return nil
end
function GetAway() -- To find the away team
for i, v in pairs(game.Teams:GetChildren()) do
if v:findFirstChild("away") then
return v
end
end
return nil
end
home = GetHome(); --Set the variables
away = GetAway();
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
local a = player.TeamColor --Set the players teamcolor
if a == home.TeamColor then --[[Find the team that corresponds to the teamcolor]]
character.Shirt:remove() --Remove the shirt
character.Pants:remove() --Remove the pants
local shirt = home.Home.Shirt:Clone() --Set the shirt to be added
local pants = home.Home.Pants:Clone() -Set the pants to be added
shirt.Parent = character --Add the shirt
pants.Parent = character --Add the pants
elseif a == away.TeamColor then
character.Shirt:remove()
character.Pants:remove()
local shirt = away.Away.Shirt:Clone()
local pants = away.Away.Pants:Clone()
shirt.Parent = character
pants.Parent = character
end
end)
end)

4 comments
What's the problem?
When the character respawns the uniform isnt put on them.
Is there any error? What debugging have you done? Do you realize the script you've pasted here has a syntax error on line 31?
Yeah lol I added the comments