Hi. I’m trying to get my Ray to ignore tagged items. “FindPartOnRayWithIgnoreList” line is causing an error. Can a ray not ignore tags or do I have something setup wrong?
local CollectionService = game:GetService('CollectionService')
function CreateRay()
local IgnoreTag = CollectionService:GetTagged('RayIgnore')
local Ray = Ray.new(Bla1,Bla2)
local Hit,Position = workspace:FindPartOnRayWithIgnoreList(Ray,{Character,IgnoreTag})
if Hit then
print(Hit)
end
end
CreateRay()
local CollectionService = game:GetService('CollectionService')
function CreateRay()
local ignoreList = CollectionService:GetTagged('RayIgnore')
table.insert(ignoreList, Character)
local Ray = Ray.new(Bla1,Bla2)
local Hit,Position = workspace:FindPartOnRayWithIgnoreList(Ray,ignoreList)
if Hit then
print(Hit)
end
end
CreateRay()
You should create and cache the ignoreList outside of the CreateRay function to improve performance, but this should get it working for you.