Hello Guys I am new here. Am trying to make a Player(Client Not Server) To destroy an Actor when Pressing the button “E” But it doesn’t work. I Searched about my problem but i couldn’t find anything. Can you please Help me !!
P.T Am using the default multiplayer system.
Destroy should only be called on the server so your ServerDestroy event should be a RunOnServer Event and not a Multicast RPC.
I Tried this as well… not working
Are there any warnings or errors in the log?
Yes here are they
if you can’t read it in the image here it is
(Blueprint Runtime Error: “Accessed None trying to read property CallFunc_BreakHitResult_HitActor”. Blueprint: MainPlayer Function: Execute Ubergraph Main Player Graph: EventGraph Node: DestroyActor
So how do you get the “target” for the Destroy node?
With A Line Trace
From The Hit Result → Hit Actor Then goes to the Destroy Actor
I see. What appears to be happening is that the Client is asking the Host to do a line trace from the Host point of view. What you actually want to happen is more likely the Client asking the Host to do a line trace from the asking Client point of view. Get rid of the Tick node and instead do the trace when the Client Press E and add the hit actor as a parameter in the ServerDestroy node and then the server simply destroy that specific actor.
BTW if the hit actor is null you should not try to call ServerDestroy as it is pointless.
Ohhh That worked !! Thank you so much.