ConvertScreenLocationToWorldSpace is unable to return a value when a client calls a Run on Server event

ConvertScreenLocationToWorldSpace is unable to return a value when a client calls the event yet when the server calls the event, it does return a value. Can I not use ConvertScreenLocationToWorldSpace in a replicated Client to Server environment?

Not sure, if I understand correctly. You want to call a server function from a client and get the client’s cursor coordinates inside that server-function? If that’s the case, I don’t think it can ever work. I would send the world position and direction from client to server by making them parameters of the server function and getting them on the client before the call.

Getting the client’s resolution and player controller is possible, as seen in the picture, but I’m wondering how ConvertScreenLocationToWorldSpace is returning false if I have its necessary values?

121253-convertscreenlocationtoworldspace.png

Oh, I didn’t realize you were posting under “Blueprint Scripting”. I was having code in mind. I still don’t know, if I would rely on the server knowing local client information like that, especially when there’s a cleaner way that doesn’t depend on it. I’m assuming you call the server function on some kind of client-click-event? Or do you call it continually every frame or so? In that case, I would understand if you want to send as little data as possible, but two vectors aren’t exactly much either.

I’m not very familiar with that blueprint function, but I would double check that it’s really meant to be used over the network and not for local players playing on the same machine.

It’s just an intuition, but I would be surprised, if an UE4 game sends a client’s resolution settings to the server by default…

The server function is called whenever the client clicks Mouse1, yes.

Ok, then sending 2 vectors along with the call is no problem whatsoever.

Apart from that, I’m 90% sure, the function you are using is not meant to work over the network but only locally.

Ok, I will try to perform the function locally and have the 2 vectors be sent over to the server.

I have set those two vectors to variables but I do not know whether to use Replicated or RepNotify. I want the variables to update and be sent to the server every time the player’s weapon is shot.

Nevermind, I’ve successfully done it! Now on to damaging other players!
Here is a video of my progress, oh how progress is so addicting!

To clarify, you cannot use the ConvertScreenLocationToWorldSpace as the server, you must use it as a client.