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

Data Store Tables?

Asked by
FOG20 5
9 years ago

local Data = game:GetService('DataStoreService')

local teleService = game:GetService('TeleportService')

local DataId = Data:GetDataStore('Test8')

local storedData = {}

                                                                                        ----------------------------------
                                                                                        --------| Data Saving Time|-------
                                                                                        ----------------------------------

                                                                                                -- Loading Data.. --

function saveData(player)

DataId:SetAsync(player.UserId, storedData[player])

end

function loadData(player)

return DataId:GetAsync(player.UserId)

end

game.Players.PlayerAdded:connect(function(player)

    local data = loadData(player)

    if not data then

    storedData[player] = {

        Money = 1,

        Level = 2,

        Stability = 3

    }

    saveData(player)

    print("Newbie")

    print(storedData)

else

    storedData[player] = data

    print("BOSS")
    --          

print(game:GetService('DataStoreService'):GetDataStore('Test7'):GetAsync(game.Players.FOG20.Us erId, storedData[1]))

end

Don't know how to reveive that tables without getting a Hexadecimal

0
Please put your code in lua block Correctly. Press the blue Lua button then paste all the code inside. alphawolvess 1784 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

That's a table

When you print a table in Lua, it just spits out the memory address. That's fine. Just check to see if it contains the things you needed it to contain instead of checking that it actually exists.

0
So add [1] at the end of the table name to index the first entry (or second if lua starts at 0) GShocked 150 — 9y
Ad

Answer this question