Marcel12311

Roblox [Small System add/remove from the table]

Apr 4th, 2022 (edited)
574
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.39 KB | None | 0 0
  1. --[[
  2. INSTRUCTION:
  3. 1.this script copy and paste to ServerScriptService
  4. 2.create Folder inside Workspace and inside folder create Part if u wanna see how to works script
  5. 3.run program!
  6. --------------------------------
  7.  
  8. ADS:
  9. my profile in Roblox:
  10. https://www.roblox.com/users/140427102/profile
  11. my profile in YouTube:
  12. https://www.youtube.com/channel/UC9mjJnPdd0aUqc_sHF2U_Tg
  13. --------------------------------
  14. Enjoy!
  15. ]]--
  16.  
  17. -----------Script to copy----------------
  18. -----------------------------------------
  19. local tabela = {}
  20.  
  21. local function findParts()
  22.     for i,v in pairs(game.Workspace.Folder:GetChildren()) do
  23.         if v and v:IsA("Part") then
  24.            
  25.            
  26.             if #tabela == 0 then
  27.                 table.insert(tabela,v)
  28.                 break
  29.             end
  30.            
  31.             if table.find(tabela,v) == nil then
  32.                 print("searched finished")
  33.                 table.insert(tabela,v)
  34.             end
  35.            
  36.            
  37.         end
  38.     end
  39. end
  40.  
  41. local function printParts()
  42.     print("----------------")
  43.     for i=1,#tabela,1 do
  44.         print(i.."."..tostring(tabela[i]))
  45.     end
  46. end
  47.  
  48. local function findPos()
  49.     local pos = 0
  50.     local arrays = game.Workspace.Folder:GetChildren() 
  51.    
  52.     for i=1,#tabela,1 do
  53.         pos+=1
  54.         if table.find(arrays,tabela[i]) == nil then
  55.             return pos
  56.         end
  57.     end
  58.    
  59.     return nil
  60. end
  61.  
  62. local function cleanParts()
  63.     local pos = findPos()
  64.     if pos then
  65.         table.remove(tabela,pos)
  66.     end
  67. end
  68.  
  69. while true do
  70.     findParts()
  71.     cleanParts()
  72.     printParts()
  73.     wait(1)
  74. end
Add Comment
Please, Sign In to add comment