So on the wiki it says it triggers when a part intercepts your ray, but can someone, using code, explain how I would execute this as;
local part, endPoint = Workspace:FindPartOnRay(ray)
doesn't make sense to me.
And how will I use it for a function that fires on this event firing (it being intercepted).
Workspace:FindPartOnRay(ray)
does as it's told (Finds a BasePart that is colliding with the ray closest to the ray's origin, like a laser hitting a wall).
In your case, part
is the BasePart that the ray has collided with, and endpoint
is the location of the collision, a Vetcor3.
You can use it for a function like this:
function YourFunction() --stuff end ray = Ray.new() --Your ray local part, endpoint = Workspace:FindPartOnRay(ray) if part then YourFunction() end
Workspace:FindPartOnRay(ray)
isn't an event, so you'd have to run the function when you want to check for intersecting parts.