I want to make sure an instance is returned before going any further, however Raycast still returns something, even when nothing is hit
local Params = RaycastParams.new()
Params.FilterType = Enum.RaycastFilterType.Whitelist
Params.FilterDescendantsInstances = {playersIsland.Items}
Params.IgnoreWater = true
-- Check for blocks below
local Raycast = workspace:Raycast(position, Vector3.new(0, -3, 0), Params)
if not Raycast then
-- Check for blocks above
Raycast = Ray.new(position, Vector3.new(0, 3, 0))
end
if not Raycast then return end
print(Raycast)
local Model = Raycast.Instance.Parent
RaycastResult{Block @ -48, 4.00002384, -52; normal = 0, 1, 0; material = SmoothPlastic}
RaycastResult{Top @ -48, 8.24997616, -52; normal = 0, 1, 0; material = SmoothPlastic}
07:23:12.997 - Instance is not a valid member of Ray
Why is the 3rd print still returning a valid position, even tho nothing has been hit?