Team clothes and Own clothes

How can i make what players from team criminals and guards have their own clothes?

function CleanPlayer(Char)
	for i,v in pairs(Char:GetChildren()) do
		if v:IsA("Shirt") or v:IsA("Pants") then
			v:Destroy()
		end
	end
end

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		repeat wait() until Player:HasAppearanceLoaded() and Character:FindFirstChild("Body Colors")
		CleanPlayer(Character)
		
		for i,v in pairs(script:GetChildren()) do
			if Player.Team.Name == v.Name then
				for i,Clothes in pairs(v:GetChildren()) do
					Clothes:Clone().Parent = Character
				end
				break
			end
		end
	end)
end)

Well, you aren’t waiting until the player has chosen a team yet and is automatically trying to give them new clothes so I suggest in your team chooser, to send a RemoteEvent with the team that the player has chosen and dress them then.

Example:

game.ReplicatedStorage.ChosenTeam.OnServerEvent:Connect(function(player,chosenTeam)
		for i,v in pairs(script:GetChildren()) do

		if player.Team.Name == v.Name then
			for i,Clothes in pairs(v:GetChildren()) do
				Clothes:Clone().Parent = Character
			end
		end

	end
end)