How do Ignore the other players characters reycasting

What I want is to make a raycast that ignores other players characters and i tried using an i,v in pairs but can’t do it so i need help

2 Likes

Hey man, what you can do is creating a table and putting inisde an ignore list, for instance:

local Hit,Position = workspace:FindPartOnRayWithIgnoreList(ray,{(whatever you want ignored)})

You can use a for loop to loop through workspace finding players’ humanoid and putting them in a variable which you can then put into the ignore table.

1 Like

I recommend you use workspace:Raycast() since its newer:

local list = {}
for _, v in pairs(game:GetService("Players"):GetPlayers()) do
    for _, q in pairs(v.Character:GetDescendants()) do
         if q:IsA("BasePart") then
            table.insert(list, v)
        end
    end
end

local params = RaycastParams.new()
params.FilterDescendantsInstances = list
params.FilterType = Enum.RaycastFilterType.Blacklist

local ray = workspace:Raycast(origin, direction, params) -- bam
3 Likes

Is there an article to read up on this new addition?

Yessir