# Onoverlapbegin fires in all clients in listenServer?

**URL:** <https://forums.unrealengine.com/t/onoverlapbegin-fires-in-all-clients-in-listenserver/490813>\
**Category:** C++\
**Tags:** overlap, replicate, listen-server, unreal-engine, UE4, question, CPP\
**Created:** [November 11, 2021, 7:33am UTC](https://forums.unrealengine.com/t/onoverlapbegin-fires-in-all-clients-in-listenserver/490813 "2021-11-11T07:33:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![PainGetter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PainGetter](https://forums.unrealengine.com/u/PainGetter)\
**Post date:** [November 11, 2021, 7:33am UTC](https://forums.unrealengine.com/t/onoverlapbegin-fires-in-all-clients-in-listenserver/490813/1 "2021-11-11T07:33:40Z")

</div>

Hi, I’m trying to make onoverlapbegin fires only in the client that made overlap happen.

I’m overriding OnOverlapBegin in C++ with the code below.

```
void AMyPickups::OnOverlapBegin(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
Super::OnOverlapBegin(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep,SweepResult);
	UE_LOG(LogTemp,Warning,TEXT("fire"));
}

```

this code fires in all clients so if i run game with 3 people in listen server, it fires three times

and i don’t have a clue about why it is happening.

i just want it to fire only in client that made this occur.

is there any way to make it happen only in one client ?

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [November 11, 2021, 8:26am UTC](https://forums.unrealengine.com/t/onoverlapbegin-fires-in-all-clients-in-listenserver/490813/2 "2021-11-11T08:26:54Z")

</div>

Of course it runs on all clients, because your item and each character are replicated to all clients and they all have their separate functionalities.

In any case, you can check if your character is locally controlled before firing the overlap function. Something like:

```
void AMyPickups::OnOverlapBegin(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
    AMyCharacter* MyChar = Cast<AMyCharacter>(OtherActor);
    if (MyChar != nullptr)
    {
        if (MyChar->IsLocallyControlled())
        {
            // your code here
        }
    }
}
```

---

<div class="post-metadata">

**Author:** ![PainGetter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PainGetter](https://forums.unrealengine.com/u/PainGetter)\
**Post date:** [November 11, 2021, 2:23pm UTC](https://forums.unrealengine.com/t/onoverlapbegin-fires-in-all-clients-in-listenserver/490813/3 "2021-11-11T14:23:17Z")

</div>

Thanks for help, it works!

but another problem happend, if i activate my custom function in OnOverlapBegin

editor says “No owning connection for actor MyPickups\_BP\_2”

---

<div class="post-metadata">

**Author:** ![PainGetter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PainGetter](https://forums.unrealengine.com/u/PainGetter)\
**Post date:** [November 11, 2021, 2:33pm UTC](https://forums.unrealengine.com/t/onoverlapbegin-fires-in-all-clients-in-listenserver/490813/4 "2021-11-11T14:33:13Z")

</div>

oh it was my mistake to put setreplicated in playerController. everything good now Thanks!
