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

Raycasting ignorelist isn't working for me?

Asked by
Macbane 46
5 years ago
--TO GET ALL PLAYER HATS
local ignoreAll = {}
game.Players.PlayerAdded:connect(function(player)
    player.CharacterAppearanceLoaded:connect(function(character)--when char spawns, add accessories to ignoreAll
        print("s")
        for i, v in pairs(character:GetChildren())do
            if v:IsA("Accessory")then
            table.insert(ignoreAll,v)
            end
        end
        character:WaitForChild("Humanoid").Died:connect(function()--when char dies remove accessories from ignorAll
                for i, v in pairs(character:GetChildren())do
                    if v:IsA("Accessory")then
                        for j, k in pairs(ignoreAll)do
                            if k.Parent == character and k == v then
                                table.remove(ignoreAll,j)

                            end
                        end
                    end
                end
        end)
        for i, v in pairs(ignoreAll)do--print all items in ignore
                    print(v)
        end
    end)

end)

After the hats are put in the table it prints such as EyePatch AlienBackpack Ultra-Fabulous Hair SilverthornAntlers CheeseHat CapandScarf

    local part, position, normal = workspace:FindPartOnRayWithIgnoreList(ray, ignoreAll, false, true)

Output error: Argument 2 missing or nil, argument 2 is ignoreAll, but it does not print nil.

Answer this question