This is my first time using datastore and I knew there would be an issue.
I’m using a module script to handle my data. Here is the module:
local data = {}
data.Save = function(dataStore,dataToSave,player)
local succ, err = pcall(function()
dataStore:SetAsync(player.UserId.."_"..dataToSave)
end)
if succ == true then
print("Saved")
else
print("There was an error.")
warn(err)
end
end
return data
The error I get is Argument 2 missing or nil, meaning that the dataToSave must be nil.
And here is how I’m using the module:
DataMod.Save(MainData,plr.leaderstats.Bits.Value,plr)
Thanks if you can help.