I want to make a map with a system of spectate and respawn after the after the combat but i don't know how to respawn a person who are in spectate mode

Help me