Function problem

hello i have a probleme i knew that function return one value, but how to return all values ?

function GetAllHumanoidRootPart()
    for _, basePart in workspace:GetDescendants() do
        if basePart:IsA("BasePart") then
            if basePart.Name == "HumanoidRootPart" and basePart ~= humanoidRootPart then
                return basePart
            end
        end
    end
end

local hit = GetAllHumanoidRootPart()
print(hit.Parent)
local list = {}
for _, basePart in workspace:GetDescendants() do
        if basePart:IsA("BasePart") then
            if basePart.Name == "HumanoidRootPart" and basePart ~= humanoidRootPart then
                table.insert(list, basePart)
            end
        end
    end

return list
2 Likes

Beat me to it, but yes, indeed.

1 Like

Yes its true, after posting my topic, i had this idea, thanks !

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.