I have an existing datastore of player data that I want to add new key/value pairs to.
The issue is that if I add a new key/value pair, then an existing player joins the game I get an error as I am trying to update a value that does not exist in their datastore.
I am new to Datastore2, I am not good at it
This is my script
Blockquote
local dataStore2 = require(game.ReplicatedStorage.Module.DataStore2)
local userDataStoreName = “UserDataStore”
local DataStoreService = game:GetService(“DataStoreService”)
local BannedDataStore = DataStoreService:GetDataStore(“DSBan”)
local Players = game:GetService(“Players”)
function setupUserData()
local userData = {
Info = {
[“Level”] = 1;
[“Xp”] = 0;
[“Cash”] = 10;
}
}
return userData
end