# RepNotify not working?

**URL:** <https://forums.unrealengine.com/t/repnotify-not-working/1277983>\
**Category:** Blueprint\
**Tags:** Networking, Replication, unreal-engine, Multiplayer, question, Blueprint\
**Created:** [August 30, 2023, 6:52pm UTC](https://forums.unrealengine.com/t/repnotify-not-working/1277983 "2023-08-30T18:52:39Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phyrriel](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Phyrriel](https://forums.unrealengine.com/u/Phyrriel)\
**Post date:** [August 30, 2023, 6:52pm UTC](https://forums.unrealengine.com/t/repnotify-not-working/1277983/1 "2023-08-30T18:52:40Z")

</div>

So I’ve been learning how multiplayer works and I thought I had a decent understanding on how to setup everything and the importances of knowing when to use RPC’s vs RepNotify. I’ve been testing making my character hold items and all seemed fine when I used RPC’s but not when I used RepNotify, I need it to work this way because when the clients runs out of Net culled distance everything isn’t in sync anymore, once the player drops the item it’s in different locations as well as floating in the air when I have coded it to drop the item to the floor. Whereas when I used RPC’s the code for dropping the item works fine instead of floating in the air. So I’m wondering why when I change the code to use RepNotify the code doesn’t work quite the same? Below is links to the code I have setup, if anyone can figure it out it would be a massive headache lifted.

PickUp Item

> **[PickUpItem posted by anonymous | blueprintUE | PasteBin For Unreal Engine](https://blueprintue.com/blueprint/y82avwu1/)**
>
> No description provided

Inside the RepNotify Variable (the pickup code works all fine)

> **[Pickup Repnotify posted by anonymous | blueprintUE | PasteBin For Unreal Engine](https://blueprintue.com/blueprint/-67mo5h1/)**
>
> No description provided

Drop Item

> **[Drop Item posted by anonymous | blueprintUE | PasteBin For Unreal Engine](https://blueprintue.com/blueprint/yeojjviv/)**
>
> No description provided

Inside Drop Item RepNotify variable

> **[Drop Notify posted by anonymous | blueprintUE | PasteBin For Unreal Engine](https://blueprintue.com/blueprint/nas84vc2/)**
>
> No description provided

---

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [August 30, 2023, 9:49pm UTC](https://forums.unrealengine.com/t/repnotify-not-working/1277983/2 "2023-08-30T21:49:29Z")

</div>

> [@Phyrriel](#):
>
> RepNotify the code doesn’t work quite the same

RepNotify is executed in the client side… so the server side don’t know what is going on and that is a replication problem.

1-Change the value of the replicated variable on server side  
2-Execute whatever function in server side  
3-Execute whatever function inside RepNotify (client side)  
4-Done!!

---

<div class="post-metadata">

**Author:** ![Phyrriel](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Phyrriel](https://forums.unrealengine.com/u/Phyrriel)\
**Post date:** [August 30, 2023, 11:19pm UTC](https://forums.unrealengine.com/t/repnotify-not-working/1277983/3 "2023-08-30T23:19:09Z")

</div>

Thanks for the response, I’m not sure how to execute that properly in my blueprints. Do you happen to know where to point me so I can go and have a look? Everything I happen to find is that they do all the code in the RepNotify and execute it on the server side.

---

<div class="post-metadata">

**Author:** ![Rev0verDrive](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rev0verdrive/32/907214_2.png) [@Rev0verDrive](https://forums.unrealengine.com/u/Rev0verDrive)\
**Post date:** [August 30, 2023, 11:50pm UTC](https://forums.unrealengine.com/t/repnotify-not-working/1277983/4 "2023-08-30T23:50:11Z")

</div>

You don’t set Rep\_notify variables in the OnRep function.

Server pickup  
Is currently holding, do some stuff → Set rep\_notify variable

On rep function: Branch (rep\_not var): true → do this, False → do something else.

Think of the on rep var as a switch/toggle. When the server changes the value of the var (toggles it) the on rep function is executed. Based on the toggled value you do A or B.

* * *

Another key factor when using Rep\_notify on actors is you should use a pretty high net cull distance. It should be higher than the actors render cull distance. This ensures that any changes occur prior to the player being able to see them.

For instance If I drop an actor w/physics it should be on the ground well before an approaching “out of range” player gets close enough to see it floating.

---

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [August 30, 2023, 11:53pm UTC](https://forums.unrealengine.com/t/repnotify-not-working/1277983/5 "2023-08-30T23:53:51Z")

</div>

![100](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/f/2/8f2db136e4a8d5e962014a5b71c94f91401a3b49.png)

![101](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/d/6/9d6ddd5e762abd4224c89e861a871e0d5a794b94.png)

---

<div class="post-metadata">

**Author:** ![Rev0verDrive](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rev0verdrive/32/907214_2.png) [@Rev0verDrive](https://forums.unrealengine.com/u/Rev0verDrive)\
**Post date:** [August 30, 2023, 11:55pm UTC](https://forums.unrealengine.com/t/repnotify-not-working/1277983/6 "2023-08-30T23:55:05Z")

</div>

Close!

Server will execute the OnRep function as soon as it sets the value. So no need to call it directly.

Srv → Set var  
OnRep Func: Do whatever

---

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [August 30, 2023, 11:58pm UTC](https://forums.unrealengine.com/t/repnotify-not-working/1277983/7 "2023-08-30T23:58:10Z")

</div>

> [@Rev0verDrive](#):
>
> Server will execute the OnRep

But it is executed on client side only

---

<div class="post-metadata">

**Author:** ![Rev0verDrive](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rev0verdrive/32/907214_2.png) [@Rev0verDrive](https://forums.unrealengine.com/u/Rev0verDrive)\
**Post date:** [August 30, 2023, 11:58pm UTC](https://forums.unrealengine.com/t/repnotify-not-working/1277983/8 "2023-08-30T23:58:42Z")

</div>

I have a 4 part series on networked doors/elevators that specifically uses a rep\_notify enumerator.

Here’s part 2 which gets into the Rep\_notify aspects. Should get you on solid ground.

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/1/d/f1d08c1c51d255deaae0afcccaf194220da772a9.jpeg "UE5 - Multiplayer Interaction System Pt 2 - Doors") ](https://www.youtube.com/watch?v=1PNMh0pYNMI&t=304)

---

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [August 31, 2023, 12:04am UTC](https://forums.unrealengine.com/t/repnotify-not-working/1277983/9 "2023-08-31T00:04:39Z")

</div>

I do it like this in C++

it is the only way it works

```auto
//------------------------------------
UPROPERTY(ReplicatedUsing=OnUpdateTeamType)
ETeam TheTeamType = ETeam::None;
//------------------------------------
UFUNCTION(Server,Unreliable)
void SetTeamType(ETeam TeamType);

//------------------------------------

UFUNCTION()
void OnUpdateTeamType();
//------------------------------------

void UMaterialHandlerComponent::SetTeamType_Implementation(ETeam TeamType)
{
	TheTeamType = TeamType;
	SetTeamSkin(TheTeamType);
}
//------------------------------------

void UMaterialHandlerComponent::OnUpdateTeamType()
{
	SetTeamSkin(TheTeamType);
}
//------------------------------------

```

---

<div class="post-metadata">

**Author:** ![Rev0verDrive](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rev0verdrive/32/907214_2.png) [@Rev0verDrive](https://forums.unrealengine.com/u/Rev0verDrive)\
**Post date:** [August 31, 2023, 12:08am UTC](https://forums.unrealengine.com/t/repnotify-not-working/1277983/10 "2023-08-31T00:08:55Z")

</div>

where are you running this code? It should be in the Game Mode. TeamType should be a playerstate variable. Any skin changes should be handled in the OnRep in the playerstate.

For something like spawn grouping by TeamType, you’d handle that in the GM.

---

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [August 31, 2023, 12:10am UTC](https://forums.unrealengine.com/t/repnotify-not-working/1277983/11 "2023-08-31T00:10:46Z")

</div>

Nope… it is a UActorComponent. i’m using it on my character.

---

<div class="post-metadata">

**Author:** ![Rev0verDrive](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rev0verdrive/32/907214_2.png) [@Rev0verDrive](https://forums.unrealengine.com/u/Rev0verDrive)\
**Post date:** [August 31, 2023, 12:21am UTC](https://forums.unrealengine.com/t/repnotify-not-working/1277983/12 "2023-08-31T00:21:08Z")

</div>

I’m assuming it only has to do with cosmetics then.

If so the Rep\_notify var should reside in the PlayerState, so all players and the GameState have a reference to it if needed.

Player State → OnRep\_Function gets a reference to the Actor Component and calls the appropriate function.

Easy Peasy

---

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [August 31, 2023, 12:29am UTC](https://forums.unrealengine.com/t/repnotify-not-working/1277983/13 "2023-08-31T00:29:20Z")

</div>

> [@Rev0verDrive](#):
>
> cosmetics

Yes, that is…

I assign the team from GameMode… but I change the skin on the character (it’s where I have access to the mesh).

I’m using the PlayerState for public variables like the Score, the Name, the ID… and the team too… what I want others to know about me.

> [@Rev0verDrive](#):
>
> Player State → OnRep\_Function gets a reference to the Actor Component and calls the appropriate function.

Nope… I have a Subsystem to handle the teams (UGameInstanceSubsystem derived class)

---

<div class="post-metadata">

**Author:** ![UnrealEverything](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UnrealEverything](https://forums.unrealengine.com/u/UnrealEverything)\
**Post date:** [August 31, 2023, 5:49am UTC](https://forums.unrealengine.com/t/repnotify-not-working/1277983/14 "2023-08-31T05:49:04Z")

</div>

BP and C++ behave differently regarding RepNotify. With BP the OnRep\_Whatever is also called for the server (with exceptions). E.g. if you change elements of an array (with Add node), OnRep won’t be called for BP either.

---

<div class="post-metadata">

**Author:** ![jwtrp](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jwtrp](https://forums.unrealengine.com/u/jwtrp)\
**Post date:** [April 20, 2024, 3:03pm UTC](https://forums.unrealengine.com/t/repnotify-not-working/1277983/15 "2024-04-20T15:03:25Z")

</div>

I am quite confused since I have the situation on 5.3 that rep notify executes on all clients but not on the server. (Blueprints)

---

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [April 24, 2024, 2:46am UTC](https://forums.unrealengine.com/t/repnotify-not-working/1277983/16 "2024-04-24T02:46:23Z")

</div>

I not sure… but maybe they changed the behaviour to be the same as in C++…  
if so, just exectute the same function in the server side after changed the value of the replicated variable.

---

<div class="post-metadata">

**Author:** ![Auran131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Auran131](https://forums.unrealengine.com/u/Auran131)\
**Post date:** [April 24, 2024, 7:22am UTC](https://forums.unrealengine.com/t/repnotify-not-working/1277983/18 "2024-04-24T07:22:27Z")

</div>

Server RepNotify doesnt occur on Arrays for whatever reason if that helps

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [April 24, 2024, 8:33am UTC](https://forums.unrealengine.com/t/repnotify-not-working/1277983/19 "2024-04-24T08:33:37Z")

</div>

@Auran131 I _abhor_ those new bots (I refuse to call them people):

They’ll grab a post from above and re-repost:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/8/f/48f80d0b9d2217fb5a2518f80e6dc48f266c6741.png)

…thinking it will somehow legitimise their account so they can keep spamming the APK links that have been popping around for weeks now. It’s not even the spam that I mind, it’s the time I spend reading necroed threads…

---

<div class="post-metadata">

**Author:** ![Auran131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Auran131](https://forums.unrealengine.com/u/Auran131)\
**Post date:** [April 24, 2024, 8:41am UTC](https://forums.unrealengine.com/t/repnotify-not-working/1277983/20 "2024-04-24T08:41:36Z")

</div>

is that what it is, i’ve seen a few repeat questions or weird replies but dont understand why’d theyd bother

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [April 24, 2024, 8:55am UTC](https://forums.unrealengine.com/t/repnotify-not-working/1277983/21 "2024-04-24T08:55:37Z")

</div>

In the olden forums days the very first account post had to be **manually** mod-approved. The bots have been living under a rock and still think it’s a thing.

Sadly, while the manual approval kept most of the spam at bay, it mostly prevented legitimate users from posting the actual question… 😑

I can only wish the previous system was still in place - flag a post to make it immediately hidden. If the user appeals, mods can restore it. Spammers won’t appeal, though.

> but dont understand why’d theyd bother

It’s draining to flag them and it’s draining to realise you’ve been had after typing for a couple of minutes just to find out it’s another what’s up apk…

[Next page](https://forums.unrealengine.com/t/repnotify-not-working/1277983.md?page=2)
