Am I Server or Client?

I have finally figured out What HasAuthority actually means after a couple of days of testing. I think this will be very helpful to many people.

HasAuthority does not tell you if the instance of the game is the server or the client. It is telling you if the actor you are running the HasAuthority check on belongs to the server or the client. So you can have a game running on a client return true to HasAuthority even if that actor was not spawned by the Client.

So as an example - If the server spawns in a pawn that has Replicate set to true, the client’s games will spawn a copy of that pawn in their level. Originally I thought only the pawn that is on the server would return true to HasAuthority() because I thought HasAuthority() was checking if the pawn is the server’s copy of it. HasAuthority() is checking if the pawn belongs to the server or the client. If the server spawned in the pawn and replicated it to the clients then the pawn on the server and all the copies of it on the clients belong to the server and will all return true to HasAuthority(). If the client possesses the pawn then the copy of the pawn on their machine will return false to HasAuthority() because the client that possessed it now owns it instead of the server.

4 Likes