I'm using "workspace:FindPartOnRay()" with a ray that is the size of the Local Player's screen. It detects Nil unless CurrentCamera is face deep into a Part.. Then it detects the part. How can I blacklist Nil from "workspace:FindPartOnRay()"?
while true do wait(0.4) local model = workspace.Model local whitelist = model:GetChildren() local camera = workspace.CurrentCamera local length = 500 local viewportPoint = camera.ViewportSize local unitRay = camera:ViewportPointToRay(viewportPoint.X, viewportPoint.Y, 0) local ray = Ray.new(unitRay.Origin, unitRay.Direction * length) print(workspace:FindPartOnRayWithWhitelist(ray,whitelist)) end