client is not working Unreal C++

Hi, i have had this problem now a while and i have no idea why client is not working, my code is not going through and im using unreal engine 5

.h
image
.cpp


i basically trying to show projectile from client

You have plenty of debug messages but your post is not showing what happens. It would be helpful.

There is a debug message “FIREING ON CLIENT” and then within the same block you have a HasAuthority() check. This doesn’t make much sense, a client doesn’t have authority.

If function Fire() executes on client, then you should call ServerFire() without the condition. The call will be executed on server.

fair enough ,mb

here are the debug messages on client when it shoots and projectile doesnt show

and this is Server when it shoots and projectile is showing

just to make sure that i follow correctly on the last bit, your saying i dont need the authority and should just call the Server_Fire? if so, i tried that but same result as the pictures

@Chatouille not sure if it replay reached you but any idea on why its not working?

Replicated functions are meant to be called from one machine to another.
A server function should be called from client side and will be executed on server side.
A Client/Multicast function should be called from server and will be executed on client(s).
If you have authority, you are on server. So checking for authority and calling a server function doesn’t make much sense.

Once you remove the authority check, client should be able to call Server_Fire and it should execute on server. Then server will spawn the projectile, and the projectile should replicate to all clients.
If that doesn’t work, one of those things is missing :

  • Weapon component must be replicated in order to be able to call replicated functions
  • Weapon must be replicated, for its component(s) to be replicated
  • Weapon must be owned by the player (character), otherwise client->server function calls do not work. When you spawn/give the weapon to player, make sure you set him as Owner.
  • Projectile should replicate

i have checkd from what you have suggested and im not sure if i still am missing something (prob but dont know where) but it doesnt work still for me, server works but not client.

can it be that the c++ script of where the Fire function is a skeletalmeshcomponent? (its defaulted code from unreal engine 5)