Need help understanding raycast

I’v been going by multiple tutorials and scripts to come up with this:

here is what I have so far

Code (CSharp):
using System.Collections;
using System.Collections.Generic;
using System.Runtime;
using System.Runtime.InteropServices;
using UnityEngine;
using UnityEngine.Events;
public class aim : MonoBehaviour
{
  
    public Rigidbody rb;
    public int clickForce = 10;
    public bool strikeBall;
    public float target;
    private RayCastHit;
    void start()
    {
        rb = GetComponent<Rigidbody>();
    }
    void FixedUpdate()
    {
  
        if (Physics.RayCast(out hit))
        {
            Target = RayCast; hitPoint;
        }
        if (strikeBall)
          
        {
            rb.AddForce(target * clickForce);
        }
    }
}

The intent is to use raycast to set a target position on x and y then I press the ui button to send a pool ball towards set target but I’m not quite sure how to use raycast. Also I want to lock the cue ball on the zed axis I’m working I 2D.

What you have here is not telling the Raycast where to aim. What you should do is figure out where you want the ray to start from, and what direction you want it to go.

Are you thinking the user would click the mouse and then the code would find where it should be in the world? Once you define that we can figure out the right syntax.