Matching part rotations

How do I match the part’s rotation using raycast?

Whats happening :

What I need :
image

what I have

	point.CFrame = CFrame.lookAt(rayres.Position, rayres.Normal) * CFrame.Angles(0, math.rad(-90), 0)

The second parameter of CFrame.lookAt is the position to look at, not the direction. You would do this instead:

point.CFrame = CFrame.lookAt(rayres.Position, rayres.Position+rayres.Normal) * CFrame.Angles(0, math.rad(-90), 0)
2 Likes