Well I don’t know if anything can be done so that more than one name can be put in a FindFirstChild, but I tried and it didn’t work …
local Touch = script.Parent.Parent.Parent.Parent.Touch
local ButtonPress = false
local ButtonPress2 = false
local Proximity = script.Parent
Touch.Touched:connect(function(p)
ButtonPress = true
ButtonPress2 = false
if p.Parent:FindFirstChild("Card", "Esposas") ~= nil then
Proximity.Enabled = true
end
end)
This isn’t possible, the second parameter defines whether or not to search for descendants (recursive)
1 Like
You can use this function or make your own.
local function findMultipleChilds(instanceToSearch,useRecursive,...)
local namesToFind = {...}
local foundObjects = {}
for i, name in pairs(namesToFind) do
table.insert(foundObjects,instanceToSearch:FindFirstChild(name,useRecursive))
end
return foundObjects,#namesToFind
end
--in your code
local foundObjects,numberOfNamesToFind= findMultipleChilds(p.Parent,false,"Card", "Esposas")
if #foundObjects == numberOfNamesToFind then
Proximity.Enabled = true
end