Child Instantiated GameObject to GameObject hit by raycast

Hi all, I’m trying to child an instantiated GameObject to another GameObject hit by a raycast but my method has yielded no new changes/results.

Here is my Code:

 if (Physics.Raycast(generalCam.transform.position, forwardVector, out hit, range, environmentLayer))
     {
          GameObject impactGO = Instantiate(impactEffect, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal));
     
          impactGO.transform.SetParent(hit.transform);
     
          Destroy(impactGO, 5f); 
     }

Turns out I left an if statement in that I was no longer using preventing my code from running properly