I am using DataStore2: and have encountered an extremely odd bug that I haven’t been able to fix. When calling DataStore(dataStoreName, player) it thinks the string I send as dataStoreName is a table. I tested this by doing typeof(dataStoreName) right above the DataStore call, and it was a string. It correctly tells me when I send a number though.
local x = "newData1A"
print(typeof(x))
local playerData = DataStore2(x, player)
What version of DataStore2 are you currently working with? Remember that DataStore2 does update frequently enough to warrant keeping up to date.
If you are using the module from Roblox, that one is no longer maintained and is several versions out of date. Reload your copy from the GitHub repo. If you’re still experiencing the issue (considering passing the string directly in the method call resulted in the error as well), consider filing an issue.
Filed an issue but was told that they have no idea what is going wrong, which makes sense as this bug has no logical explanation. I’m thinking it’s a problem with Roblox because nothing else makes sense.
I was testing it a bit, and the DataStore2() call fires twice, first time printing the correct type and name (in my case string, “newData1A”. But then immediately prints again table, “Table: xyz123” so I’m pretty lost.
Yeah, I added print(typeof(dataStoreName) print(dataStoreName.Name)
before the assert() while trying to diagnose the issue, and it printed both twice with the values I posted above. I suggest you test this for yourself as well.
I found the bug. When I call Datastore.Combine(), i used the “:” operator to call it, instead of the dot “.” operator. Do Datastore.Combine(), that should fix it.
I tried this also and I didnt get a print on either, yet my error is the same except not “table, instance”, its “string, string”.
I have no clue how to code this kind of stuff but any help would be appreciated
Im all set too Like Colbert said, staying up to date on the DS2 is what fixed my issue.
I was lucky enough to google the error and found this thread, and solved my problem.
I wonder why all the other methods of Datastore2 use the : but this one alone uses . to call the function, it’s confusing and inconsistent.
Furthermore, I had been using the : to call the function and it did work for a while in my code that was using : (some OOP modules that were using combine) but when I tried using Datastore2:Combine in normal functions I got the errors.