2003 Ford mustang transmission

Ok so I replaced my 2003 Ford Mustang 3.8 V6 with a new transmission but it's doing this thing where you put it in drive and I press the gas the speedometer needle goes crazy and the car feels like it's going to lose power and doesn't shift can someone please help me

You replaced the engine with a transmission?

You have a bad speed sensor of forgot to connect the wiring to it on the side of the transmission

If the "new tranny" is a used one it has to be the same exact year transmission.