Hello everyone. I cannot replicate from client to server with blueprints.
I want to know how can I change a variable from client that will change on both server and client.
There is a string variable called “testStr” in myGameState. It’s default value is “default”.
When, the player press “H”, testStr from myGameState changed to “changed”.
When, the player press “J”, it prints the value of testStr.
So the client changes the testStr by pressing “H”, and shows the value “changed” when he press “J”.
But when the server press “J”, it shows the default value “default”.
I ticked the “replicate” property of myGameInstance in class defaults panel. I ticked the “replicate” property in variable testStr.
It seems like both the client and server has separate gameState and the client just shows it’s gameState and server just shows it’s gameState.
I have also tried with gameInstance too. Not working. Just showing the separate values of the variable.
I have also tried with gameMode. Client can’t cast to gameMode so it doesn’t work.
I have also tried changing the variable with a function with “run on server”, “multicast”, “run on owning client” in myGameState but they all fail and the server just shows the default value “default”.
Pls tell me how to change a variable by client that will change on both client and server. Thanks.