Download

Variable not replicating across clients

Heres my setup:

In the first pic, the path on the top is for the server and on the bottom its for the client. The server enters the total players that are needed for the game, and the clients each increment the PlayersJoined value. Then the both run the PlayerJoining function (second pic). My problem is that I cant replicate the variables across the clients or the server. The Totalplayers only stays on the server, and the PlayerJoined only on the client. I have successfully hosted and joined a session.

I would create a function in game mode to increment the number which is a variable in gamestate.

In join the player controller calls a custom event on post login that is run on server… To call the game mode function to increment.

Gamestate:
vTotalplayers (replicated)

Gamemode:
(Add player)switch authority>cast to gamestate>Set vTotalplayers vTotalplayers+ 1

Player controller:
onpostlogin>custom event(run on server)cast to Gamemode>add player

Event play–
Delay .2>cast to gamestate>get vTotalplayers>print

Player State is “lite” version of player controller, each client has his own player state all all other player states replicated to them. Unlike PlayerController which is only on server and each client has its own copy of playercontroller (does not have other clients player controllers).

So try with playerstate

Thank you, Ill try these methods