I’m working on a game and I decided to add a script to help convert data for a player whenever I add a new variable to the average data every person has.
This is the function to get the basic data if you have no data and you’re new:
And this is the code that detects either no data, data existing but outdated and data:
(This code grabs another plain table and replaces all the values inside the new table with the ones that already exists in the player’s existing but outdated data, and the TABLEVERSION variable is how it detects outdated data.)
When this data is converting, what it prints each time is the index and value of the player’s existing but outdated data table and this is what it returns:
In the index position, we have the value and in the value position we always have nil.
This has been breaking my game for some time and I need serious help.
hmm, I’m not sure why you’re using e as the index for the tables.
within’ the pairs loop, that if statement can you change it to this: if data[i] and type(data[i]) == type(newtable[i]) then newtable[i] = data[i]
That would end up overwriting any existing data with a blank table since the pairs loop is with a new table instead of one pulled from datastore.
So using data[i] in this case should work.