I want to emulate this code here.
DETECTING MULTIPLE PARTS WITH THE OLD FUNCTIONALITY
function findAllPartsOnRay(ray)
local targets = {}
repeat
local target = game.Workspace:FindPartOnRayWithIgnoreList(ray, targets)
if target then
table.insert(targets, target)
end
until not target
return targets
end
My horrible attempt...
local function findAllPartsWithRay(ray)
local targets = {}
repeat
wait()
local target = nil
if hit then
target = hit.Instance.Parent:FindFirstChild("Humanoid")
end
if target then
table.insert(targets, target)
print("added target lol")
for _, v in pairs(targets) do
print(v.Name)
end
end
until not target
return targets
end
Any insight would be very helpful.