在保存错误时尝试使用 'Value' 索引 nil

Attempt to index nil with 'Value' While saving Error

所以我试图保存 3 个东西,但即使在打印它有效的值时,它也无法在保存脚本中为它们编制索引:

game.Players.PlayerRemoving:Connect(function(player)
    local stats = player:FindFirstChild(ns0)
    if not stats then return end
    local vals = {stats:FindFirstChild(nc0),stats:FindFirstChild(nc1),stats:FindFirstChild(nc2)}
    print(vals) -- returns: {...}
    print(vals[1], vals[2], vals[3]) -- returns: Cash NumberValue dropspeed
    print(vals[1].Value, vals[2].Value, vals[3].Value) -- returns: 0.1 0.02 9.5
    print(player.UserId) -- returns my user Id
    --if vals and vals[1] and vals[2] and vals[3] then
    if vals[1] and vals[2] and vals[3] then
        ds:SetAsync(player.UserId,{vals[0].Value, vals[1].Value, vals[2].Value}) -- attempt to index nil with Value error occurs here
    end
end)

有什么问题?

vals[0] 被索引为 nil,所以我将 vals[0] 更改为 vals[1],将 vals[1] 更改为 vals[2] 等