Basically I want a ray to ignore every HumanoidRootPart it hits. I made a table containing the parts but it errors: Unable to cast value to Object I'm using FindPartOnRayWithIgnoreList by the way as there are other models I want to ignore. It works if I list it like tihs: ignoreTable[1], ignoreTable[2] etc.. as many times as many max players I have but there has to be a better way.
Here, let's start from scratch to make the table. First I'm going to create a for loop and see if their character and humanoidrootpart is not nil, then add it to the ignorelist table
local ignorelist = {} for _,v in pairs(game.Players:GetPlayers()) do if v.Character and v.Character:FindFirstChild("HumanoidRootPart")~=nil then table.insert(ignorelist,v.Character.HumanoidRootPart) end end
Now I have a table to give FindPartOnRayWithIgnoreList that includes every player's humanoidrootpart