Only one of the values will save in my table "Stage.Value" but non of the others will save

game.Players.PlayerAdded:Connect(function(bot)

	local data
	local success, err = pcall(function()
		data = ds:GetAsync(bot.UserId)
	end)	
		
	if success then
		dc.Value = data[1]
		jc.Value = data[2]
		wc.Value = data[3]
	else
		print("error or no data")
		warn(err)
		dc.Value = 0
		jc.Value = 0
		wc.Value = 0
	end
end)

game.Players.PlayerRemoving:Connect(function(bot)

	local save = {}
	
	table.insert(save, bot.PlayerStats.Deaths.Value)
	table.insert(save, bot.PlayerStats.Jumps.Value)
	table.insert(save, bot.PlayerStats.Wins.Value)
	table.insert(save, bot.leaderstats.Stage.Value)
	
	local success, err = pcall(function()
		ds:SetAsync(bot.UserId, save)
	end)
	
	if success then
		print("data saved")
	else
		print("error data not saved")
		warn(err)
	end
end)

4 comments

1

:SetAsync().

0

maybe because on lines 25-27 you use bot.PlayerStats instead of leaderstats like you did on line 28

0

that wasnt it i had 2 folder instances i went to and statements instead of trying to save a whole table and it works good enough thx for the help

0

Are You Getting Any Errors?