When I do NewRay.Position, I get nothing in the output. Just cause there’s no part found, I should still get a returned result? How can I do this if FindPartOnRay is deprecated?
return function(start, target)
local Direction = (target - start).unit
local Params = RaycastParams.new()
Params.FilterType = Enum.RaycastFilterType.Blacklist
Params.FilterDescendantsInstances = {BulletsContainer}
Params.IgnoreWater = true
local NewRay = workspace:Raycast(start, Direction.unit * 999, Params)
print(NewRay.Position) -- Prints nothing
return NewRay.Instance, NewRay.Position
end
This works, as hit just returns nil, but endPos is still valid
function(start, target, ignore)
local dir = (target - start).unit
local ray = Ray.new(start, dir.unit * 999)
local hit, endPos = workspace:FindPartOnRay(ray, ignore)
return hit, endPos
end