Surface Normal formula not working as intended

I have this script :

game.ReplicatedStorage.RemoteEvents.InkEffects.LightInkDrop.Event:Connect(function(Char, StartPoint, EndPoint)

local Clone = game.ReplicatedStorage.Items.LightInkDrop:Clone()
local RayCast = Ray.new(EndPoint, EndPoint - StartPoint)
local Hit, Pos, Normal, Material = workspace:FindPartOnRayWithWhitelist(RayCast, {workspace.Terrain}, true)

–Clone.Size = Vector3.new(2, 0, 2)
Clone.CFrame = CFrame.lookAt(EndPoint, EndPoint + Normal)
end)

All I want it to do is just align the object with the surface normal.
However, the object that I am trying to align to the surface normal is just facing a random direction.

Something that helped me a lot right now was visualizing the raycast. So now my problem is how to really align the object to the surface normal.

You can surround code with backticks:

```
like this
```

to get code

like this

Anyways, this looks mostly fine. What are StartPoint and EndPoint?

1 Like

I can show you an image of it. StartPoint and EndPoint are the origin and destination of the ray.


The blue object is the object I am trying to align.
The skinny part is the visualization of the ray.

Ok guys, never mind I just found out that I was supposed to offset the orientation with CFrame.Angles()