For some reason it kept printing “1” This is what the script looks like.
while task.wait() do
for i,v in ipairs(workspace.FolderWork:GetChildren()) do
local ignored = {'Part'}
local parts = {}
if not table.find(ignored,v.Name) and not table.find(parts,v) then
table.insert(parts,v)
print(#parts)
end
end
end
local parts = {}
while task.wait() do
for i,v in ipairs(workspace.FolderWork:GetChildren()) do
local ignored = {'Part'}
if table.find(ignored,v.Name) then return end
if table.find(parts, v) then return end
table.insert(parts,v)
print(#parts)
end
end
end
It didnt really print anything out! I forgot to mention that when the player walks near the part it will be named close and when they are far away it will be called part again!
Im not sure if I sayed it correctly! I was trying to say Ive added that already I just want the script to know how much parts that are called Close are in there!
local parts = {}
while task.wait() do
for i,v in ipairs(workspace.FolderWork:GetChildren()) do
local ignored = {'Part'}
if table.find(ignored,v.Name) then return end
if table.find(parts, v) then return end
if v.Name ~= "Closed" then return end
table.insert(parts,v)
print(#parts)
end
local FolderWork = workspace.FolderWork
local blackList = {"Part"}
local CloseCount = 0 -- Count for "Close" part
while task.wait() do
for _ , partChild in pairs(FolderWork:GetChildren()) do
if table.find(blackList, partChild.Name) ~= nil then
continue -- Skip this iteration, move on to the next one.
end
if partChild.Name == "Close" then
print("Find 'Close' Part!")
CloseCount = CloseCount + 1 -- Add the count
end
end
print("Current 'Close' part in Folder" .. CloseCount)
CloseCount = 0 -- This value resets once the loop is done, it will give you an actual count of 'Close' part.
end