I'm getting y I already have x but I want to transfer Pokemon from that to y and I need two 3ds and friend codes how do I set his up to make it work.
If you have a friend's FC, you can borrow their 3DS and transfer Pokemon like that, or you could use Pokemon Bank (free ndownload from the E-shop, but $5.36 initially once you go into PB. The $5.36 is to purchase a pass to be able to actually use Pokemon Bank). Once you get Pokemon Bank, you can deposit your Pokemon from X into the bank, insert Y, and withdraw them in Y.
Source: - Bits and pieces of what I've heard and what I gathered from this issue (not really an issue, but you get it :P ) - http://www.pokemonxy.com/en-us/strategy/