How to make a sound on a character play locally only

Here’s my question, I’m working on a multiplayer game and added some code to the BeginPlay function of my character to load a looping sound. Currently we’re testing this on a listen server and all clients plus the host player hear the sound too. Basically, the BeginPlay function is called on all the remote players, and I’m trying make an if statement so the code that loads the sound only gets called locally. I’ve tried many different methods, but haven’t had any luck.

Here’s my code so far. http://pastebin.com/raw.php?i=biRvgrRM

Try this

void AMyCharacter::BeginPlay()
{
	if (IsLocallyControlled() && SomeLoopingSound)
	{
		SomeSoundAC = UGameplayStatics::PlaySoundAttached(SomeLoopingSound, GetRootComponent());
		SomeSoundAC->AdjustVolume(0.f, 0.f);
	}

	Super::BeginPlay
}

You will also need your sound to have an Attenuation setting so that the audio engine knows how to attenuate according to the distance of your audio listener.

IsLocallyControlled() doesn’t work, the listen server player can still hear everyone’s sound. I feel like I’ve tried every imaginable thing, but I’m still not getting anywheres.

Try checking Role instead then.

if (Role != ROLE_SimulatedProxy && SomeLoopingSound)
{
   //PLAY SOUND
}

Did you solve it? I’m running the same issue.