#Table not following the rules of nature herself

1 messages · Page 1 of 1 (latest)

hollow hollow
#

what is ToolsTable

#

also dont use pairs its useless

blazing fiber
#

i dont understand your wording

hollow hollow
#

me neither

mild siren
hollow hollow
#

is it a table

#

or folder

#

or what

mild siren
#

Table

#

🙏

opal needle
#

when you use pairs combined with table.remove() you're likely skipping over indices. table.remove() is going to automatically shift the index of the table

mild siren
#

OH

#

I see

#

Wait wth do I replace it with then?

trail shell
#

add a shift variable i think and increase when you remove something

local shift = 0
for i,v in ... do
  table.remove(ToolsTable, i - shift)
  shift+=1
end
short chasmBOT
#

studio** You are now Level 10! **studio

unique bloom
opal needle
#

that's the same thing

#

as table.remove()

mild siren
#

I see

#

leme re-write then

mild siren
unique bloom
trail shell
#

ToolsTable[b.Name]=nil wont work unless ToolsTable is a dictionary but im pretty sure its being used as an array

#

you would have to do ToolsTable[i] = nil

unique bloom
mild siren
#

I got 21 results that 21 items have been removed
but the other 20
no feedback

#

._.

trail shell
#

can i see your new code

mild siren
trail shell
#

oh try doing this

#
local shift = 0
for i=1,#ToolsTable do
  local b = ToolsTable[i-shift]
  local founditem = workspace.Settings.WorldName.BannedItems:FindFirstChild(b.Name)
  if founditem then
    table.remove(ToolsTable, i - shift)
    shift+=1
    print("...")
   else
     warn("...")
   end
end
mild siren
#

aight

trail shell
#

i think the variable 'b' was also skipping over indices and you have to correct it with shift as well

mild siren
#

ah

#

could be

trail shell
#

nice

mild siren
#

1 sent a not removed feedback

#

Thanks mate.