local Players = game:GetService("Players")
local DatastoreService = game:GetService("DataStoreService")
local database = DatastoreService:GetDataStore("data")
local PlayerData = DatastoreService:GetDataStore("data", "PlayerData")
local sessionData = {}
local function CachePlayer(Plr: Player)
local success, errormessage = pcall(function()
local DataToInsert = {
["Username"] = Plr.Name
}
print(DataToInsert)
database:UpdateAsync(Plr.UserId, DataToInsert)
end)
end
local function LoadData(Plr: Player)
local success, Data = pcall(function()
return database:GetAsync(Plr.UserId)
end)
print(Data)
end
Players.PlayerAdded:Connect(CachePlayer)
Players.PlayerAdded:Connect(LoadData)
the players data is a single table; but im trying to get it to be multiple tables
how it is rn
data = {["Username"] = "aeroactual"}
What am triyng to acheive
print(data) = {["Username"] = "aeroactual"},
{["Username"] = "aeroactual}
--etc, a new table created everytime the player joins
i would like it to insert a new table into the players data everytime it joins
so if the player joined once it’d have one table in its data then if it joined twice it’d have 2 tables in its data
right now it replaces/updates the users table
i’d want it so it creates a new table everytime they join and it each one is saved to the users key
is this possible?
Why? That’s pointless, you will just end up bloating their data for no reason. The larger the data the more time it will take to process all of that data.
I am not going to hand hold you. Please refer to the documents. if you do not know how to do something and have the resources to understand please use them.