Make transparent parts touch with use ray

Hello, I have a script containing this.

How do I write the script correctly? Here I use to find out the Attachment position.WorldPosition. When using IgnoreList, everything works, but if I transfer to RayPartOnWay, it gives an error. How do I rewrite getting an Attachment position?
and yes, i have this warn > Unable to cast value to Object

1.txt (63,4 КБ)

local attachmentorigin = v.WorldPosition|
local attachmentdir = v.WorldCFrame.LookVector * 1|

hitPart, hitPoint, hitNormal, hitMaterial = Workspace:FindPartOnRay(castRay, blacklist)

hitPart, hitPoint, hitNormal, hitMaterial = Workspace:FindPartOnRayWithIgnoreList(castRay, blacklist, false, ignoreWater)

Unable to cast value to object error - Help and Feedback / Scripting Support - Developer Forum | Roblox
I think I’ve found something that can help me, but not exactly