DataStore returning table values as nil?

So basically, i’m trying to save custom values (StringValues).

This is what happens once the player is leaving:

The Module for saving:

As you can see, i’ve printed for testing what prints after they leave and every value in the table is printed as “nil”

Any idea why this is happening?

when scripting you only use ‘:’ when your passing the table itself as a argument which are not doing in this case so instead you need to use “.”. Here are the corrections:

in the module change this line

function module:SavePlayerData(Player,Data)
--to this
function module.SavePlayerData(Player,Data)

also, when your calling the module do this instead:

Save.SavePlayerData(--parameters here)

also, you are printing out indexes not in the table this

I think the issue is that the Data is stored by keys rather than by indices. So Data[1] should be Data[“Skin”], for example… I think that’ll give you what you’re looking for

1 Like

Yeah, that was the problem. Thanks for the response :slight_smile:

1 Like

Thanks for the fast response, found a solution but I appreciate the help. The thing is, I was actually TRYING to get the table as an arg.