Raycast not detecting the floor

Well, this is the script I have:

local RockRayParams = RaycastParams.new()
        RockRayParams.FilterDescendantsInstances = {Rock}
        RockRayParams.FilterType = Enum.RaycastFilterType.Blacklist
        local RockRay1 = workspace:Raycast(Rock.CFrame.p,Vector3.new(0,-5,0),RockRayParams)
        if RockRay1 then
            Rock.Color = RockRay1.Instance.Color
            print("Rays haven't detected anything ;(")
  1. What do you want to achieve? Keep it simple and clear!
    I want the ray to detect the floor, then get color and give it to the part.
  2. What is the issue? Include screenshots / videos if possible!
    As the rays don’t detect anything, the parts stay on their default form.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have tried increasing the ray direction, and make another ray going the inverse direction (up) but it still doesn’t detect anything. I didn’t find something that could help me.

Unfortunately raycasting has a slight caveat. If the origin of the ray is within any part, it cannot detect/hit that part.

That could possibly be the issue here. If so, try raising the origin position of the ray up a few studs and then casting it longer to account for that.


local RockRay1 = workspace:Raycast(Rock.CFrame.Position + Vector3.new(0, 5, 0),Vector3.new(0,-15,0),RockRayParams)