Client mouse position problem!

Hello! I am learning the unity network, and got a problem that I have tried to fix for ages :frowning: . Hope you guys can help me out!

[Problem] :

When a player shoots, my script instantiates a projectile prefab at the players position and then a projectile script move the projectile to mouse position.

It works fine for a single player but when i try with 2 players (1 host and 1 client) client shoots to the mouse position of the host. It works fine for the host but i couldn’t make clients to shoot to their own mouse positions. (It seems that host’s screen still on when clicking client’s window) How can I get client’s own input mouse position?

[Script attached to projectile prefabs]:

void Start()
        worldPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        flyTime = (worldPoint - transform.position).magnitude / (speed);
        Invoke("DestroyProjectile", flyTime + 0.09f);

// Update is called once per frame
void Update()
    if (speed > 0)
        float step = speed * Time.deltaTime;
        transform.position = Vector2.MoveTowards(transform.position, worldPoint, step);


Good day.

For your text, I understand is the server ho calculates the direction.

You need the client to send to the server the position of its mouse as a world vector3 position.

So server will know what position of the world must be the destiny of the bulet. Then make the server start the movement with that world position.