I got a script here that replaces a table value from nil to 0.
The table is initialized like this:
local PlayerInv = {40,nil,nil,nil,nil,nil,20,nil,nil,nil,nil,nil,20,nil,nil,nil,nil,nil,20,nil,nil,nil,nil,nil,25,nil,nil,nil,nil,nil,10,nil,nil,nil,nil,nil,10,nil,nil,nil,nil,nil,3,6,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,4,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,4}
I had to do it that way because previously, it would erase every value from index 2 and on. So, i had to manually type out the table like this. And yes, i did use table.insert. Didn’t work
Anyways, im using a module function to replace one of these nils with a 0. The script looks like this:
at the “set” intent, im trying to replace the nil with a 0. It iterates the inventory perfectly, printing off the correct values. But the moment it gets to Inventory[Data] = number, it will print 20. meaning EVERYTHING but the 1st index was wiped. Idk why it does this, but its really irritating. Any ideas?
here is the print log:
40
nil(x5)
20
nil(x5)
20
nil(x5)
20
nil(x5)
25
nil(x5)
10
nil (x5)
10
nil(x5)
3
6
nil(x13)
4
nil(x13)
4
40