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)
Just a notice - Instead of directly removing the shirt/pants - check whether they have those or not. It will error if they don't have either of those.
Or assuming they have shirts/pants - you can change the ID to the away/home ID instead of adding/removing.