Specifically I want to get the ray through the part that was hit if that makes any sense.
feel free to ask any questions
Specifically I want to get the ray through the part that was hit if that makes any sense.
feel free to ask any questions
https://developer.roblox.com/en-us/api-reference/datatype/RaycastResult
RaycastResult.Instance
Wrong. If WorldRoot:Raycast does not intersect a part or terrain cell within the specified distance, it returns nil.
https://create.roblox.com/docs/reference/engine/classes/WorldRoot#Raycast
local ray = workspace:Raycast(Vector3.new(0,10,0), Vector3.new(0,-10,0))
if ray then
print(ray.Instance.Name) -- SpawnLocation (that is if you have an unchanged baseplate template)
end
Obviously, but the thread’s poster was asking how to get the part that was hit (at least from what I was able to decipher).
the part that was hit
Additionally, Workspace:Raycast()
does not receive a ‘distance’ parameter, it receives parameters for an ‘origin’, a ‘direction’ and a ‘raycast parameters object’.
My bad. I misread what the OP was asking.