Instantiating a projectile pointing at target.

Hi everyone.
So I have a player and a target. I want the player to instantiate a projectile, with its rotation pointing at the target (from the player).
my idea was this-

  shotDirection = Quaternion.FromToRotation(transform.position, target.transform.position);
    if (Input.GetKeyDown(KeyCode.Keypad1))
    {
        Instantiate(projectile,transform.position,shotDirection);
    }

but it seems that “FromToRotation” doesn’t work the way I expected it to.
Can someone please advice?

Sure- you’re thinking of

Transform.LookAt(position);

However, since this actually rotates the transform (which I don’t think you want to do) You may instead want this-

Quaternion.SetLookRotation(target.transform.position - transform.position);