I’m trying to insert the names of all children under this folder into a table:
Here’s my issue, I’m not sure how to handle this.
I’m aware that I have to use a table when using in pairs(), but I have no idea how to handle this.
I also tried to count the number of children inside the “Allies” folder, but once again, that gives me an integer and not a table.
Here’s my code - note that Humans.Parent is replicated storage.
local rs = game.ReplicatedStorage
local allies = rs.Humans.Allies
local part1 = script.Parent
local allytypes = {}
for i,v in pairs(allies) do
table.insert(allytypes,i,tostring(v.Name))
end
local function GetTouchingParts(poggerspart)
local connection = poggerspart.Touched:Connect(function() end)
local results = poggerspart:GetTouchingParts()
connection:Disconnect()
return results
end
while wait() do
for j, v in pairs(GetTouchingParts(part1)) do
if table.find(allytypes,tostring(v.Name)) then
v:Destroy()
end
end
end
Thanks so much to anyone who helps out