Raycasting Params not working

I cant seem to get Raycast Parameters to work. When I blacklist something, it doesnt work.

local filter = {}

for i,p in pairs(game.Players:GetPlayers()) do
  filter[p] = p.Character

filter[rtarget.Parent] = rtarget.Parent
local Params = RaycastParams.new()
Params.FilterDescendantsInstances = filter
Params.FilterType = Enum.RaycastFilterType.Blacklist
local Result = workspace:Raycast(player.Character.PrimaryPart.Position, mouse.Hit.p, Params)
if Result then
  print(math.floor(Result.Normal.X ),math.floor(Result.Normal.Y ),math.floor(Result.Normal.Z ))
1 Like

try setting the filter[p] to filter[i] as the FilterDescedantsInstances expects a table and not a dctionary.

1 Like

If the solution worked dont forget to mark it as a solution so other people who have the same problem know how to fix it

1 Like

Sadly it didnt work :sob:, but thanks for trying anyways!

I did some debugging, and I’m pretty sure that Result.Instance will return any part that the rays hit, even with blacklist/whitelist.

I still cant get this to work >:(, I dont know what I’m doing wrong. But I’ll keep on trying.

try this?

table.insert(filter, p.Character)