Raycast results returning nil

also thats a pic from like 1 day ago, because now its not working at all because of the raycasts

Can you do this please? By that I mean place an Anchored part in the middle of the Ray, and make its size the Ray’s size. Don’t forget about CFrame.LookAt to show the exact CFrame!

the hitbox is not even appearing so it wont work most likely but ill try

how do i do that tho, i have tried but it doesnt work
image

Also, Make the HitBox transparency 0 to make sure it is in the right place. And, I will try to give you an script to do the Part trick, but I’m on mobile so it might not work.

local Part = Instance.new("Part")
Part.CFrame = CFrame.lookAt(Ray.Origin-RayEnd,RayEnd)
Part.Size = Vector3.new(0.1,0.1,(Ray.Origin-RayEnd).Magnitude)

PartEnd is the Position of the RayResult

it is in the right place. ill try your script

uhh how do i get ray end tho, i can do result.Position but the problem is that result is nil

1 Like

Then you may change that into the old workpace:GetPartOnRayWithWhitelist(Or something like that, I’m on mobile) that returns Hit,Position and Normal.

okay ima try that and tell ya if it works

1 Like

well, the placement is now working but snapping to surface isnt

Can you make a print(Normal) and show the part where you convert the Normal into an CFrame.Angles?

wait im trying to make ray parts to see if theyre in the right position

I belive you want the part to rotate so it will stay on the part? You can make a table with all the Faces

local Faces = {
 [Enum.NormalId.Right] = CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))
 -- Etc
}

Part.CFrame = CFrame.new(EndPosition) * Faces[Normal]

hmm
look what happens when i print surface normals
image

Can you tell me Line 192,193 and 194?

@TFlanigan I edited the post

what do you mean by 192 193 194

I mean Line, not Like. As I said, I’m on mobile

ok so the surface normals return (0,0,0)

Can you please show line 192? 3000 chars

is this what you mean?

1 Like