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

How do I make it so that rays go through some parts?

Asked by
xEiffel 280 Moderation Voter
5 years ago

Basically, I have this script where it makes a ray and then detects if below it is a floor. This is what I have:

for _, Player in pairs(Players:GetChildren()) do
        local Character = workspace:FindFirstChild(Player.Name)
        if Character then
            local Humanoid = Character:FindFirstChild("Humanoid")
            local RootPart = Character:FindFirstChild("HumanoidRootPart")

            if (Humanoid and RootPart) then
                local CreateRay = Ray.new(Character.PrimaryPart.CFrame.p, Vector3.new(0, -1000, 0))
                local Object = workspace:FindPartOnRayWithIgnoreList(CreateRay, self.ignoreList, false, false)
                print(Object:GetFullName())
                if Object.Name:match("Floor") then
                    self.connections[Object:GetFullName()] = self.connections[Object:GetFullName()] + 1;
                end
            end
        end
    end

Basically, still with the ignore list it still counts player body parts (LowerLeftLeg) etc. and I don't know how to fix this. Is anyone able to help?

Here is the list setup:

function Scp106:SetupLists()
    for _, Object in pairs(workspace:GetDescendants()) do
        if Object.Name:match("Floor") then
            table.insert(self.connections, Object:GetFullName())
            self.connections[Object:GetFullName()] = 0;
        else
            if (not Object.Name == "Terrain") then
                table.insert(self.ignoreList, Object:GetFullName())
            end
        end
    end
end

Thank you.

Answer this question