when i join and get player data i get this error "attempt to call a number value" in the output

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

game.Players.PlayerRemoving:Connect(function(bot)
	
	local dc = bot.PlayerStats.Deaths.Value
	local jc = bot.PlayerStats.Jumps.Value
	local wc = bot.PlayerStats.Wins.Value
	local sc = bot.leaderstats.Stage.Value
	
	local success, err = pcall(function()
		ds:SetAsync(bot.UserId, dc and jc and wc and sc)
	end)
	
	if success then
		print("data saved")
	else
		print("error data not saved")
		warn(err)
	end
end)

6 comments

0

Can We See The Save Data You Saved In The Player.Removed?

0

yes

0

the data saves but when i rejoin to get data i get that error

0

That's not how the logic works my friend: {dc, jc, wc, sc}, not boolean operators.

0

Just DM me my discord is in my Bio, I'll fix it for you if you have more problems.

0

okay thanks