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

attempt to call a number value?

Asked by
LaysCo 61
4 years ago
Edited 4 years ago

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)
0
Can We See The Save Data You Saved In The Player.Removed? CoolMcroy 35 — 4y
0
yes LaysCo 61 — 4y
0
the data saves but when i rejoin to get data i get that error LaysCo 61 — 4y
0
That's not how the logic works my friend: {dc, jc, wc, sc}, not boolean operators. Ziffixture 6913 — 4y
View all comments (2 more)
0
Just DM me my discord is in my Bio, I'll fix it for you if you have more problems. Ziffixture 6913 — 4y
0
okay thanks LaysCo 61 — 4y

Answer this question