I have already made a datastore inside a module, but for some reason it won't save with the table, and there is no errors, if anyone could help that'd be great
local module = {}
local datastore = game:GetService("DataStoreService"):GetDataStore("Data #1")
function module.load(plr)
local overheadtron = plr:WaitForChild("Stats"):WaitForChild("OverheadTron").Value
local tron = plr:WaitForChild("Stats"):WaitForChild("Tron").Value
local tronc1 = plr:WaitForChild("Stats"):WaitForChild("TronCurve1").Value
local tronc2 = plr:WaitForChild("Stats"):WaitForChild("TronCurve2").Value
local theme = plr:WaitForChild("Stats"):WaitForChild("ThemeSong").Value
local vc = plr:WaitForChild("Stats"):WaitForChild("VirtualCurrency").Value
local nickname = plr:WaitForChild("Stats"):WaitForChild("Nickname").Value
local hair = plr:WaitForChild("Stats"):WaitForChild("Hair").Value
local mask = plr:WaitForChild("Stats"):WaitForChild("Mask").Value
local shirt = plr:WaitForChild("Stats"):WaitForChild("Shirt").Value
local pants = plr:WaitForChild("Stats"):WaitForChild("Pants").Value
local values = {hair, mask, shirt, pants, vc, nickname, overheadtron, tron, tronc1, tronc2, theme}
local savedTable = datastore:GetAsync(plr.userId.."-key")
if savedTable ~= nil then
values = savedTable
end
end
function module.save(plr)
local plrid = plr.userId
local overheadtron = plr:WaitForChild("Stats"):WaitForChild("OverheadTron").Value
local tron = plr:WaitForChild("Stats"):WaitForChild("Tron").Value
local tronc1 = plr:WaitForChild("Stats"):WaitForChild("TronCurve1").Value
local tronc2 = plr:WaitForChild("Stats"):WaitForChild("TronCurve2").Value
local theme = plr:WaitForChild("Stats"):WaitForChild("ThemeSong").Value
local vc = plr:WaitForChild("Stats"):WaitForChild("VirtualCurrency").Value
local nickname = plr:WaitForChild("Stats"):WaitForChild("Nickname").Value
local hair = plr:WaitForChild("Stats"):WaitForChild("Hair").Value
local mask = plr:WaitForChild("Stats"):WaitForChild("Mask").Value
local shirt = plr:WaitForChild("Stats"):WaitForChild("Shirt").Value
local pants = plr:WaitForChild("Stats"):WaitForChild("Pants").Value
local values = {hair, mask, shirt, pants, vc, nickname, overheadtron, tron, tronc1, tronc2, theme}
datastore:SetAsync(plrid.."-key", values)
end
return module

1 comment
actually I am calling the module function, but it won't save, and I have api services on