I cant seem to make the datastore script work.Heres my script(No output)
local DS = game:GetService("DataStoreService"):GetDataStore("SaveData")
game.Players.PlayerAdded:Connect(function(plr)
wait()
local plrkey = "id_"..plr.userId
local save1 = plr.leaderstats.Knowledge
local save2 = plr.leaderstats.Cash
local GetSaved = DS:GetAsync(plrkey)
if GetSaved then
save1.Value = GetSaved{1}
save2.Value = GetSaved{2}
else
local NumberForSaving = {save1.Value,save2.Value}
DS:GetAsync(plrkey,NumberForSaving)
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
DS:SetAsync("id_"..plr.userId,{plr.leaderstats.Knowledge.Value,plr.leaderstats.Cash.Value})
end)
anything i can do to make it work?