workspace:Raycast returns a RaycastResult
local raycastResult = workspace:Raycast(Character.HumanoidRootPart.Position, Vector3.new(0, -10, 0), SetRaycastParams)
You can get the BasePart or Terrain by doing this
local hitPart = raycastResult.Instance
and the color with this
hitPart.Color
here the tutorial