# Questions about turn based local multiplayer game

**URL:** <https://forums.unrealengine.com/t/questions-about-turn-based-local-multiplayer-game/369925>\
**Category:** Multiplayer & Networking\
**Tags:** turn-based, unreal-engine, local-multiplayer, UE4, question, CPP\
**Created:** [September 9, 2016, 3:46pm UTC](https://forums.unrealengine.com/t/questions-about-turn-based-local-multiplayer-game/369925 "2016-09-09T15:46:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_b691192c1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b691192c1](https://forums.unrealengine.com/u/anonymous_user_b691192c1)\
**Post date:** [September 9, 2016, 3:46pm UTC](https://forums.unrealengine.com/t/questions-about-turn-based-local-multiplayer-game/369925/1 "2016-09-09T15:46:52Z")

</div>

Hi there, I am trying to do a Connect 4 game. I want the 2 players to have the same input keys to play. I Achieved to create the players and spawn them in the world.

I can play as Player1 without any issues but when I use the “SwapPlayerControllers” method and play as Player2, I got a strange problem. When I move the token left or right, the input seems to be triggered twice.

I think I made it wrong. What is the best way to change the active player in my case ?

Here is some code of my GameMode class :

```
void APuissance4GameMode::InitFirstPlayer()
{
	UWorld *World = GetWorld();
	Player1 = Cast<AP4Pawn>(UGameplayStatics::GetPlayerPawn(World, 0));
	if (IsValid(Player1))
	{
		//TPP1 is a TargetPoint placed in the editor
		Player1->SetActorTransform(TPP1->GetActorTransform());
		Player1->EnableInversedControls();
	}
}

void APuissance4GameMode::SpawnSecondPlayer()
{
	UWorld *World = GetWorld();
	APlayerController *PC=UGameplayStatics::CreatePlayer(World, 1, true);
	Player2 = Cast<AP4Pawn>(UGameplayStatics::GetPlayerPawn(World, 1));
	if (IsValid(Player2))
	{
		//TPP2 is a TargetPoint placed in the editor
		Player2->SetActorTransform(TPP2->GetActorTransform());
	}
	
}

void APuissance4GameMode::SwitchPlayer()
{
	APlayerController *OldPC = Cast<APlayerController>(CurrentPlayer->GetController());

	if (CurrentPlayer == Player1)
	{	
		CurrentPlayer = Player2;	
	}
	else if (CurrentPlayer == Player2)
	{
		CurrentPlayer = Player1;
	}

	APlayerController *Controller = Cast<APlayerController>CurrentPlayer->GetController());
	SwapPlayerControllers(OldPC, Controller);
	
}

```
