Replicate Flashlight from Character

Hey guys,

I am trying to set up a flashlight that is turned on by holding the F key. It works locally but I cannot get it to replicate across clients.

Here is what I currently have as a set up:

Character Blueprint:

Flashlight Function Blueprint:

Kind of at a loss on how to get it to replicate. I could be close, I could be miles away from the solution.

Cheers.

This in the general direction?

Still not working at this stage. Sorry to be a pain, I’m still learning this whole replication lark.

Try making a custom event that is set to “Run on Server”. Use it twice for your F key, as you already did with your function. Also add an input for the bool. Let this event set your Flashlight bool.

Use the Event Tick with a second replicated event that Runs on the server. Pass the bool to this event too and call the normal toggle flashlight function from this event. The setup of the function can stay the same i guess.

:X This should work. :smiley: sometimes i have a twist in my head too when thinking about the RPC system.

You need to plugin the exec pin of your replicated event to the set node of the bool :D. Yes something in that way.

Check if it’s working like that, if not, try adding a second replicated event that runs on the server. Use this at your Event Tick to call the Toggle Flashlight function.

Haha, no problem. Just started my UE4 to make you an example, but i guess i can close it again. (: Please mark the question as resolved by clicking at the check mark at the left side of my answer.

Well aren’t I just a fool. That works perfectly.
Thanks for your help there eXi. Really appreciate it.

Posting to show working Blueprint for Flashlight - Thanks to eXi’s help.