Sorry, I meant table.find. I was just trying to make sure that there’s absolutely no way to use table.find in that way. I understand that it returns objects and not strings, but sometimes there seems to be ways to request a search via object names instead. Either way, that doesn’t seem to be the case in this situation.
Absolutely no way, because GetChildren returns references to objects. Your table would look like this:
{
workspace.Part1,
workspace.Part2,
...
}
Can’t use table.find on something like that. Not even if you have the string set to the path because then the value types aren’t equivalent. Have to use a loop.
If you want to find only parts by a certain name then you could do it this way.
local function findPart(name)
local instance = workspace:FindFirstChild(name)
if instance:IsA("Part") then
return instance
end
return nil
end
local stopSignPart = findPart("StopSign")
if stopSignPart then
print("StopSign found.")
else
print("Not found, returned nil")
end