To start, the purpose of the script is to let bricks detect ceiling, but it doesnt ignore anything that has a humanoid so ive been trying to achieve that the ray ignores all of the parts that are in a table but i havent been able to achieve it
I did actually manage to do the table but i havent been able to insert the elements of the table into the blacklist, usually it just gives me the error
Infinite yield possible on ‘Workspace:WaitForChild("{}")’
while wait() do
local safeParts = {}
local rayOrigin = script.Parent.Position
local rayDirection = Vector3.new(0, 10, 0)
local raycastParams = RaycastParams.new()
for i, v in pairs(game.Workspace:GetChildren()) do
local hum = v:FindFirstChild("Humanoid")
if hum then
table.insert(safeParts, v)
print("good2")
end
end
raycastParams.FilterDescendantsInstances(game.Workspace:WaitForChild(safeParts))
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
local raycastResult = workspace:Raycast(rayOrigin, rayDirection, raycastParams)
if raycastResult then
local hitPart = raycastResult.Instance
local hum = hitPart:FindFirstChild("Humanoid")
if hitPart ~= nil and hum == nil then
print("good")
end
end
end
I’d gladly appreciate any help or comments on this