Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Data store not saving all my values only 1 help?

Asked by
LaysCo 61
3 years ago
Edited 3 years ago

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)
1
:SetAsync(). Ziffixture 6913 — 3y
0
maybe because on lines 25-27 you use bot.PlayerStats instead of leaderstats like you did on line 28 greatneil80 2647 — 3y
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 LaysCo 61 — 3y
0
Are You Getting Any Errors? CoolMcroy 35 — 3y

Answer this question