I just bought a Nikon D3400 and it came with a kit including the Vivitar* (series 1) 500mm f/8 telephoto lens. I expected it to attach and work immediately, but the t mount adapter* for the lens attached it physically but not electronically it also said "lens not attached in all modes except manual. Is it the mount, the lens itself, the camera, or am I doing something wrong? please help.
There is nothing to "fix". This lens has no electrical connections to be made to the Nikon D3400.
Because there's no electrical connections to be made, the camera doesn't even know there's a lens attached, or determine the type of lens attached. Thus, you have to set your camera to Manual exposure mode, and set ISO, aperture, and shutter speed yourself — the camera has no way of controlling the lens's aperture, or of knowing what aperture the lens is set to.
Nikon doesn't sell any camera kits with 3rd party lenses such as this Vivitar lens. This lens + camera kit sounds like was a Nikon reseller's bundling.
So no, you're not doing anything wrong, per se. You just have more expectations than your lens + camera body can deliver on.
The Nikon D3400 is a F-Mount body. Looks like you will need an adapter.
Something like this: https://www.amazon.com/Vello-Lens-Mount-Adapter-Camera/dp/B0085MS5G6