local castRay = Ray.new(mouseRay.Origin, mouseRay.Direction * 1000)
local hit, position = game.Workspace:FindPartOnRayWithIgnoreList(castRay, rayCastIgnoreList)
Why does this error appear?
local castRay = Ray.new(mouseRay.Origin, mouseRay.Direction * 1000)
local hit, position = game.Workspace:FindPartOnRayWithIgnoreList(castRay, rayCastIgnoreList)
Why does this error appear?
Which line exactly is erroring? It’s one of the parameters of the functions that’s wrong, for sure.
Line 264, which is the second line in what i sent. I know its one of the parameters but I don
t know which one or what is wrong with it.
Can you show the line where you localled rayCastIgnoreList
?
It seems like it’s not a table with objects.
rayCastIgnoreList = {ConnectionList, WireList}
for _, plr in pairs(game.Players:GetPlayers()) do
if plr and plr.Character then
table.insert(rayCastIgnoreList, plr.Character)
end
end
local mouseRay = Mouse.UnitRay
local castRay = Ray.new(mouseRay.Origin, mouseRay.Direction * 1000)
local hit, position = game.Workspace:FindPartOnRayWithIgnoreList(castRay, rayCastIgnoreList)
Right now the two lists, ConnectionList and WireList are empty.
If ConnectionList and WireList are NOT objects (if they are tables or something), then it will error, as the rayCastIgnoreList must only contain existing objects.
ConnectionList and WireList are both tables, right? that’s likely your problem.
also use workspace:Raycast, because Ray.new is deprecated
Thanks. I will just use for loops to add their items into the main table.
Does it support ignorelists as well?
Yes,
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Blacklist
params.FilterDescendantsInstances = {workspace.ignore}
it also supports collisiongroups