I set the event to rep to the server, but its repping to the client instead. This event is being called from a reference varaible of the player controller. If i change the reference to a get player controller 0 node and call the event from that then it reps to the server. And then after that the variable works
Hi, the only player controller that exists on a client is the player controller of that client which you can access by using GetPlayerController with index 0. So on the client, that reference variable to the player controller you have there is either equal to what you get with GetPlayerController with index 0, or it is None.
So maybe you’re missing something else or I’m misunderstanding the question…
the event is set to replicate on the server but its replicating on the client. But if you “jiggle the wires” so to speak then it starts working properly. More a bug then a question unless some can see why it would possibly rep to the client in this situation
This event is being called from a
reference varaible of the player
controllerIf i change the reference to a get
player controller 0 node and call the
event from that then it reps to the
server.
If you do this on a client, then AFAIK you can only get different results, if the first time your reference variable is None (maybe try printing your reference variable), in which case the event won’t be called at all. Cause there is only one player controller on a client (all other player controller do not exist on that client), and you can get a reference to it by using GetPlayerController with index 0. If the client calls a RunOnServer event on its player controller, then it will be executed on the server.
So it seems to me that you’re either doing something different / something different is happening than what you described in your question, or I misunderstood what you’re doing, cause there is only one player controller on a client which you can access via GetPlayerController with index 0, so you cannot access two different player controller on a client, only if one is the player controller of that client and the other is None. Also AFAIK a RunOnServer event will never execute on a client, it will be dropped =)
Not sure what AFAIK is
This is being called from a screen widget which is constructed from the clients controller and its reference var is set on construct there.
If i hook it up to the get controller 0 it runs from the server, if I then hook the var back up it also runs from the server from then on out
AFAIK means “as far as I know”
This is being called from a screen
widget which is constructed from the
clients controller and its reference
var is set on construct there.If i hook it up to the get controller
0 it runs from the server, if I then
hook the var back up it also runs from
the server from then on out
It sounds like the reference variable to the clients controller doesn’t get set correctly from the construct and is None. I would do some prints in relevant places to make sure (for example where it doesn’t work, print the reference var of the player controller and also print GetPlayerController with index 0 and compare both)
Otherwise instead of setting it in the construct, try setting the player controller reference when the game begins (GetPlayerController with index 0 and set it with that).