Setting Attachments Offset

Anyone know of a better way to set an attachments offset in the opposite direction of two parts than this? 90% of the time, I get the error ‘Attempt to index nil with normal’ and the raycast prints as nil.

		C.CFrame = CFrame.lookAt(Player.Character.PrimaryPart.Position + Vector3.new(0, 25, 0), Loc.Position)
		C.Touched:Connect(function(part)
			DeletePart(C, part)
			return
		end)
		Params.FilterDescendantsInstances = {Target} -- Target = Mouse.Target
		local R = workspace:Raycast(C.Position, Loc.Position * 1000, Params)
		C.Att2.Position = R.Normal * 15

Ray is not hitting anything and when it does the normal is an enum.

Unless i am missing something, the only time thd ray should not be hitting something is when the final position is over 1000 studs away. As for the normal being enum, id there any fix for that?

I found a video that might help: How to resize a part from one face using a script, animated in roblox studio - YouTube

Vector3.FromNormalId(normal) maybe?

considering my part for some reason isn’t facing the correct direction even though I should be setting it in the right direction, I don’t think that’ll work. I’ve decided to go back to using Direction Vectors but I am still getting weird results. it works okay for some directions, but for others it doesn’t work at all.

		local DirectionVector = (Loc.Position - C.Position).Unit
		C.Att2.Position = DirectionVector * -10