Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I put a Table in a raycasting ignore list?

Asked by 3 years ago
Edited 3 years ago

I've been in over my head for the last couple of hours over this problem: I have a gun that I'm working on and I want it to shoot through certain things. I was successful at this, but only with objects that were a part of a model or folder. The main problem I'm having is implementing a table into the ignore list. Here is some of the code:

local IgnoreParts = {}

for i, v in pairs(workspace:GetDescendants()) do
    if v:IsA("BasePart") then
        if v.CanCollide == false then
            table.insert(IgnoreParts, v)
        end
    end
end

That's my table.

for i,v in pairs(IgnoreParts) do

    print(v)
end

This is the section of the table I'm lost at. "v" contains all the values I need to ignore, however I have no idea how to put it into this bit of raycasting code.

workspace:FindPartOnRayWithIgnoreList(ray,workspace.IgnoreParts:GetDescendants() or IgnoreParts

"or IgnoreParts" is obviously wrong, but I can't figure out how to hook up the values of "v" to that.

0
I figured out the solution to this problem. TechnoTurbo 0 — 3y

Answer this question