Variable from client doesn't replicate to the server

Hi,

I’m trying to set a boolean to true from a client to the server, however the server keeps seeing it as false (OnComponentBeginOverlap prints ‘false’ when I called Capture with a client, and run in the Sphere as the server). The C_Capture Capture event is called when the player presses a key. The CaptureSphere can be seen as a sphere in the level in which the player needs to stand to be able to call the Capture event.

When a player has called the capture event, the CaptureSphere should notice that someone is capturing it and no other player should be allowed to capture it at that moment.

What am I missing?

Hey,
sadly I’m absolutely bad in Blueprints, but let’s try with my c++ knowledge :slight_smile: :
After the input event you check if executing machine has authority but that can never happen, as the server doesn’t receive inputs, so if a machine triggers that event it’s definitely a remote client (or a listen server, but yeah, then it’ll only work for that specific person). You’d need some sort of server function (I do not know how this is handled in Blueprints) to notify the server about what happened and then do all the stuff after the HasAuthority-Switch.
I hope this helped a bit :slight_smile:

Hm however if I try to test that I am Authority I get a different result. As you can see in the screenshots I fired the event while playing in the client window.

Okay, looks like I didn’t read the question carefully enough… However I do not really understand what exactly the problem is? What part doesn’t work?
(However I’m still confused that the input is somehow also done on the server?)

Well I’m trying to set a boolean to true, while being the client, however the server still sees it as false. I’ve stuffed all my code in the PlayerPawn class directly now, and all the sudden it works… I don’t understand why it only works directly in the player class…

Well it’s pretty late over here, so I hope what I write makes some sense at least, BUT re-reading all that stuff (especially the title) I think there’s some degree of mis-understanding as replicating works only from the server->client as the Server is always the authorative instance in your game (you can change that to some degree, but in general …)

To change variables on the server you have to use the server-functions. However, I don’t exactly know why it works now that you just moved the code … ?
I hope someone with Blueprint-knowledge can give some deeper insight and help here :slight_smile:

It seems that I can only do thing as the ‘player’ when I add the logics to the ‘player class’. But I need to know how I can set stuff for the player in different blueprints, I thought I got this working earlier, but all of the sudden the clients are not able to do the stuff the server is able to do.