I am saving 3 values when i load in the values are not what they should have saved as the first value mul should have saved as 1 but is saves as 0 and the plrstats should have saved at 100 in the output it says nothing a on it

local ds=game:GetService("DataStoreService"):GetDataStore("tylergoatboy4282")
local fol=Instance.new("Folder",game.ServerStorage)
fol.Name='PlayerMoney'

game.Players.PlayerAdded:Connect(function(plr)
	local id='id-'..plr.UserId
	--leaderstats and save stats--
	local plrstats = Instance.new("NumberValue",fol)
	local mul=Instance.new('IntValue',plrstats)
	local save=Instance.new('NumberValue',plrstats)
	local OwnsTycoon=Instance.new('ObjectValue',plrstats)
	OwnsTycoon.Name='OwnsTycoon'
	mul.Name='mul'
	plrstats.Name=plr.Name
	save.Name='save'
    mul.Value=1
    plrstats.Value=0
	
	--getasink--
	local getsave=ds:GetAsync(id)
	if getsave then
	 plrstats.Value = getsave[1]
	 mul.Value=getsave[2]
	 save.Value=getsave[3]
else 
  local  NumbersForSaving = {plrstats.Value..mul.Value..save.Value}
  ds:SetAsync(id, NumbersForSaving)
	
	end
end)


game.Players.PlayerRemoving:Connect(function(plr)
	local id='id-'..plr.UserId
	local sa=game.ServerStorage.PlayerMoney:FindFirstChild(plr.Name)
	local savetable={sa.Value..sa.mul.Value..sa.save.Value}
	ds:GetAsync(id,savetable)
	end)

9 comments

0

any errors in the output

0

User variable names that make sense and show what they contain. Never use non word and one letter variables.

0

what

0

Please provide more than just a brief sentence if you're going to dump 50 lines of code. Is there anything in the output?

0

there is nothing in the output

0

did you enable studio access to api services

0

on line 37 you are trying to save data with :GetAsync(). Think about that for a moment.

0

:SetAsync() works thanks 

0

No problem, be sure to put [Solved] in your title so that people know that you no longer need help.