Event Tick getting called on all client/server

I would love someone to explain this to me, I have set up an inventory system where I want text to appear above the object, ie “Press E to Interact.” To do this I am doing an event tick and doing a line trace and seeing if the object has the interact interface to it, if it does it draws a new widget it. This works fine except at the start of the event trace I have to cast to a thirdpersoncharacter and get the follow camera even though I am already in the thirdpersoncharacter bp. If I don’t cast it it will apply the line trace to all attaching clients/server. Attached is my BP, any help with what I am doing wrong or a more efficient

way would be apricated.

Hi, since the player character exists on all clients the event tick will execute on all clients. If you only want the local client to do something, check IsLocallyControlled.

What you’re currently doing is: GetPlayerCharacter with index 0 will always be the local player character, so on tick you get the local character of each client (which will only on the local client be equal to the character you’re doing this logic in, all other clients will use a different character, namely the one they are controlling) and then do the following logic for all clients with their local character, what you don’t want.

So you need to check whether the local client is currently executing this and only then continue, otherwise you will still do this for every client and its just luck that the linetrace from the camera of any of the other clients doesn’t hit an object that implements the InteractInterface.


And more efficient would be to use a timer instead of tick. There is no need to trace that often, you should be able to get away doing this only about 10 times per second or so (but ofc if you need it 60 times per sec or what frame rate you have, then you can keep it on tick).

Awesome thanks for explaining it!

I did think about that, would you start the timer at the event begin play and have it run every .1 of a second? Sorry I am still learning all the nodes.

would you start the timer at the
event begin play and have it run every
.1 of a second?

Yes that sounds good (and only set the timer on the local client). Running the logic you have there every 0.1 seconds on a single actor won’t have any impact on performance at all.