If that so there is no fix for this issue right here, because the F4 function is built into the game. Basically when you're in the spectating mode you're qualified dead. it should respawn you to your last location however When you Requested a Class selection the script will automatically spawn you. Because you didn't bought a skin change ofc. So thats why its respawning you to another place.
Although after some 2 minutes thinking it can be fixed. OnPlayerRequestClass. You can see if the player is from Spectating the last clue
"Probably a variable" And on that you can easily spawn that player from a his last location. or from the OnPlayerSpawn.
