Collect Item multiplayers/Replicated

Hello I would like to create a system for collecting replicated objects. , I looked at the tutorials a bit but without really finding anything approximate.
a system where all players can collect an item (very simple with a destroy actor at the end I think) but replicate and all players receive the widget notification 1 of 3 collect for example.
I don’t know if I should do it in REPnotify or multicast ?


RepNotify is better but you’ll want it in your GameState not GameMode

also dont put anything after DestroyActor, its likely to fail since the actor no longer exists.

Okay thank you for your answer, can you guide me on how to do it in Repnotify? I am lost on the use of Repnotify I had already done some tests without success

make the variable repnotify, this will create a separate function.

when you interact do a server RPC and decrement the Int

In the OnRep function update you widgets, play sounds etc

Hello thank you for answering I am a beginner and I admit to having difficulty and not having understood your answer well, I created the variable RepNo, For the moment I have the server and the client which we have the widget when I take a care kit the numbers of kits picked up are not synchronized it remains at 0/2 for the client only and the actor does not disappear on the client but everything works on the server.


Its the integer you want on RepNotify so this will update any time the integer is changed.

you can delete the bool but if you didnt want it, it also needs to be on the server RPC

(post deleted by author)

Hello
I come back after a few days of trying and I’m still confused, I know it’s certainly a stupid thing to do but my head is on fire lol I have the actors which are deleted in the client and the servers but I can’t follow your advice
I think that on the screens the solution is obvious but I don’t see it




so DecrementInt is only on server, no RPC needed.
then OnRep dont do any code just use it to update your widget if needed

How do I update the widget? on the server it works well but on the client it remains at 0/2 collect, should I cast to widget from the Repnotify total kit and remaining kit? if so what to put in the cast to widget objects?


when you create the widget, likely on begin play, save a reference to it, then on repnotify get the Ref and update the values

Thank you for your response but how to update the values?
if I get remaining kit for set remaining kit I get an infinite loop error
same thing for the repnotify function of total kit

like i said above you dont set the value in the OnRep, its already set hence your loop, all you need to do is get a Ref to the widget and update the widget value

Hello
Is this the right way to update? on the client 0/2 is displayed regardless of the number of kits picked up



GET Whellref not set,
Then you’ll have access to your widget, from there you can call something like UpdateCollects and pass through the Int