here is my script
I want it to save Dollars, Level, Exp, and MaxExp too
but it wont...
local dss = game:GetService("DataStoreService") local datas = dss:GetDataStore("DollarSaveStore") --local datalv = local startercurrencyvalue = 30 local starterlv = 1 local starterexp = 0 local startermaxexp = 100 local autosaves = 0 game.Players.PlayerAdded:Connect(function(plr) ---I wont add a data store thing right now too lazy local scope = "id-"..plr.UserId local leader = Instance.new("Folder") leader.Name = "leaderstats" leader.Parent = plr local currency = Instance.new("IntValue") currency.Name = "Dollars" currency.Parent = leader local getsaved = datas:GetAsync(scope) if getsaved then currency.Value = getsaved[1] else local numberstosave = {startercurrencyvalue,starterlv,starterexp,startermaxexp} datas:SetAsync(scope,numberstosave) end local function OnAutoSave() while true do wait(25) local scope = "id-"..plr.UserId local savetable = {plr.leaderstats:WaitForChild("Dollars").Value} autosaves = autosaves + 1 local sucsess, err = pcall(function() datas:SetAsync(scope,savetable) end) if not sucsess then print("During AutoSave No."..autosaves.." The Saving Prosses had failed for Player: "..plr.Name) else print("Save Succsful!!! :D") end end end local thread = coroutine.create(OnAutoSave) coroutine.resume(thread) while true do wait(5) currency.Value = currency.Value + 2 end end) game.Players.PlayerRemoving:Connect(function(plr) local scope = "id-"..plr.UserId local savetable = {plr.leaderstats:WaitForChild("Dollars").Value,plr:WaitForChild("Level").Value,plr:WaitForChild("Level").Exp.Value,plr:WaitForChild("Level").Exp.MaxExp.Value} local sucsess, err = pcall(function() datas:SetAsync(scope,savetable) end) if not sucsess then warn("There was an error saving your IMPORTANT Wielding Data!") end end)