Hi guys, I'm trying to save a leaderstats with 2 values, here's my simple code:
ds = game:GetService("DataStoreService"):GetDataStore("DsName")
PlayerStats = game:GetService("ServerStorage"):WaitForChild("PlayerStats")
--Creating a leaderboard--
game.Players.PlayerAdded:connect(function(player)
local key = player.UserId
local playerfolder = Instance.new("Folder",player)
playerfolder.Name = "leaderstats"
local kill = Instance.new("IntValue", playerfolder)
kill.Name = "kills"
local point = Instance.new("IntValue", playerfolder)
point.Name = "points"
local asset = ds:GetAsync(key)
if asset then
kill.Value = asset[1] --Error appear at this line.
point.Value = asset[2]
else
local newleaderstats = {kill.Value, point.Value}
ds:SetAsync(key, newleaderstats)
end
end)
An error: "ServerScriptService.Script:51: attempt to index local 'asset' (a number value)" appeared at line 20 of my code. Was the error due to my datastore having only a single int value hence local asset is deemed as a variable and not an array? any idea what's wrong with it?

2 comments
Ahh i see now, yeah that seemed to be the problem. Changing the key did the trick of eliminating the error. There isn't any way to reset datastore right? can't seem to find the old data using Datastore Editor
Like I said use like "DsName2" for a blank datastore its the same as a reset.