Second post today about the same piece of code… fun lol. Anyways, I’m making a new datastore, and the saving function I’m using isn’t working. Basically, I put in a number value (in this case, the player’s money), and it should save it to a metatable with all player’s information in it. However, when I try to save, I get the error, “Argument 1 Missing or Nil”, and the only argument I’m using (player’s money) prints out fine. Not sure what I need to do here, but any help is appreciated!
Code:
function Module:SaveData(fTokens)
local FTokens = fTokens
print("Module data inputted: " .. fTokens) --The value is clearly here when it is printed...
local Suc, Response = pcall(function()
self.DataStore:UpdateAsync(self.UserId, function(FTokens)
self.Data.FrenzyTokens = FTokens
return self.Data
end)
end)
if not Suc then
warn("Save data falure!", Response)
end
end