I have an actor from the character class, and I spawn it from the server. While spawning, I feed it with a ThirdPersonCharacter reference from custom “GameMode” class (Because i need to spawn it front of random player). It appears in front of the player and runs towards the player. When it reaches the player, it jumps, runs past, and disappears. I have a function that works perfectly in standalone/single-player mode; it forces the player to look at it before it disappears using “Set Control Rotation”. The “Set Control Rotation” function is within the spawned character itself. However, it still works fine on the server, but there’s no chance on the client. I don’t want to use replication or RPC for it; I want it to happen on the client itself.
Here is the function;
SetControlRotation needs to happen on client-side. Your TargetPlayerREF seems not replicated, you should replicate it. GetController will return null for all other clients, so make sure to check it or make sure to run that function only for the relevant player.
Yes, you are right; I am not replicating TargetPlayerREF; I spawn the actor on the server, and it is only known by the server. Even if replication is done, it still doesn’t turn the client, not even the chosen one. I think there is another way for set control rotation client. I think the real question is: How can I set the client’s control rotation from the server-spawned object locally.