How do i make spectator logic

Hello guys, so i have a question, how do i make a spectator logic for the players that died and i would like to switch between the players that are left alive with a button for example . i started with unreal 3 months ago and i dont know how that type of things work.