What do you mean it is not replicated?
Possession only happens on the server (as you mentioned). What are you expecting to happen and what is actually happening?
Hi,
So I have two characters named “Hunter” and “Prop” as you can see and I want when I press the Tab key the Hunter (who is the default pawn class) to switch to the Prop character.
On the server side the change is well done but when it is the client who presses the key, the Prop Character is created but nothing happens, he doesn’t possess him !
(I’m a french teenager so my english is not perfect and I tried as much as possible to well explain)
it should be “run on server”, and not “run on owning clients”.
The reason behind this is possessing can be only call from the server (autorithy) to avoid cheating (imagine if you can posses the player of someone else).
Here, you execute on Owning client, that mean you want to run the function on the owning client but :
a) Like multicast, this is only allowed to be run from the server
b) There is no owner on the moment, and when there is no owner, the owner is the server (by default).
Don’t panic, i’m french too, and you’re english is probably better than mine
Aherys_ answer is correct. Just to add further to this.
You are getting confused with the editor window listed as “Server”. What you are seeing is NOT the server.
You are running a listen server, which means the first client creates the server, however the window itself is showing the client’s view for that server. So you are seeing it working in that window believing it is the server, where actually, you’re just seeing a client the same as the other window.
Follow Aherys_ advice, make sure your actors are set to replicate correctly and you should be good to go.
Also, logs are your friend! Keep an eye on the output log and you will clearly see where things are executing and you will probably see some messages directing you to the problem.
probably the get player controller, remember they are not the same from each instance of the game.
But just print who is the owner ship as @alekaan01 said, you can see better where is the trouble here.
Or always attach a screen of you’r blueprint, so we can see if you did a mistake.
As Aherys_ and myself have mentioned. The possession MUST happen on the server.
In that screenshot, you are firing a server event, which then fires a client event that then tries to possess the pawn.
I also see you are trying to do this in the character class. It is better practice for the PlayerController to handle the possession.