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

Is there a ignore list for .Touched function?

Asked by 6 years ago

I'm trying to ignore multiple parts that are in a table in a .Touched function

local ignore = {}
touchevent = workspace.Part.Touched:connect(function(touched)
                 if touched ~= ignore then
                    print("aaa")
                end
            end)

1 answer

Log in to vote
0
Answered by
UgOsMiLy 1074 Moderation Voter
6 years ago
Edited 6 years ago

You would check if the part is a descendant of the things on the ignore list.

local ignore = {}

workspace.Part.Touched:Connect(function(hit)
    for _,v in pairs(ignore)do
        if hit:IsDescendantOf(v) then return end
    end

    -- code

end)
Ad

Answer this question