So, I am creating a custom admin script, and I can't figure out how to save Tables using DataStore2.
I've created a script, but it just gives me an error saying that :OnUpdate is a nil value.
ServerScript in ServerScriptService:
local DataStore2 = require(1936396537)
local bansTable = {}
local adminsTable = {}
game.Players.PlayerAdded:Connect(function(player)
local admins = DataStore2("Admins",player):GetTable(adminsTable)
local bans = DataStore2("Bans",player):GetTable(bansTable)
local function updateAdminsTable(plr)
table.insert(adminsTable,plr)
end
updateAdminsTable(player)
admins:OnUpdate(updateAdminsTable)
end)
And this is the error I am getting: https://gyazo.com/a841277fc7a44676143c03d5e8483fe9

2 comments
Thank you!
How do I change the values of SessionData?