Casting a ray from the character yet also making the ray ignore the character?

This is just a small issue I ran into. I just got into learning about raycasting and ran into a slight issue. I put a localscript into starter char scripts and put this in:

local Players = game:GetService(“Players”)
local player = Players.LocalPlayer
local character = player.Character
if not character or not character.Parent then
character = player.CharacterAdded:wait()
end

if character then
if character:FindFirstChild(“HumanoidRootPart”) then

  local part = character.HumanoidRootPart

  local origin = part.Position
  local direction = part.CFrame.UpVector * -100

  local raycastParams = RaycastParams.new()
  raycastParams.FilterDescendantsInstances = {character}

  raycastParams.FilterType = Enum.RaycastFilterType.Blacklist

  local raycastResult = workspace:Raycast(origin, direction)

  if raycastResult then
  	print(raycastResult.Position)
  	print(raycastResult.Instance)
  end

end
end

I’m trying to make it ignore the character as a whole, but it keeps just printing “LowerTorso” when I play test it. Any way to fix this?

You forgot to plug in your raycastParams to the actual raycast, it should be:
workspace:Raycast(origin, direction, raycastParams)

1 Like

wow… i cant believe i missed that. thanks!