x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Variable in GameState only being modified on Client side

Hi all,

I am trying to modify an array variable located in my custom GameState, WITHIN my custom GS blueprint, and only the client recognizes the change, not the server. I know this because I have the length of the array print on Event tick. Client prints correct amount, server prints 0. The variable is set to Replicated. I'm stumped. Any idea why?

Product Version: UE 4.18
Tags:
more ▼

asked Apr 09 '18 at 05:51 AM in Blueprint Scripting

avatar image

cnClockwork
5 3 3 6

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

Do you set the variable on the Client? Replication only happens from Server to Client never from Client to Server.

Make sure you Set the variable server-side.

more ▼

answered Apr 09 '18 at 12:15 PM

avatar image

GarnerP57
691 3 4 6

avatar image cnClockwork Apr 09 '18 at 05:52 PM

Thank you for your reply. How could I do this?

avatar image GarnerP57 Apr 10 '18 at 01:13 AM

You need to send a RPC (RunOnServer event) from an Actor that the client sending it already owns like the owned PlayerController or the possessed Pawn etc. Then when you successfully sent the RPC you can set the replicated variable by the server from there.

(comments are locked)
10|2000 characters needed characters left

thanks man saved me after 8 hours , for anyone with my problem : you cant change variable of gamestate / game mode from HUD even if you set the event as RunOnServer , you have to cast from HUD to Player Controller and run on server from there . (you are client in my example if you are server it doesn't matter)

more ▼

answered Jan 28 '19 at 09:10 AM

avatar image

EZEL3050
5 2 1 4

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question