So, I'm Making A Ban Hammer And I Want To Add People To A Table In Which They'll Be Kicked Out. I'm Trying To Store The Table In Datastore2, But I Have No Clue Of How To Do It. Also, I Need To Update The Table Every Time Someone Gets Banned. I Know It Sound Kinda Simple, But I'm Really Struggling With It. I've Tried With Data Store (The One That Roblox Brings) Because I Thought It'll Be Easier And Now I Know It Wasn't.
Here Is The Last Version Of My Code, In Which I Didn't Succeed :/
--// Ban Data Store \\--
local BannedList = {410710393}
local RealBannedList = {}
pcall(function()
if game:GetService('DataStoreService'):GetDataStore('BannedPeople'):GetAsync('ABannedList') then
return
else
local Data = game:GetService('DataStoreService'):GetDataStore('BannedPeople'):SetAsync('ABannedList',RealBannedList)
local Table = game:GetService('DataStoreService'):GetDataStore('BannedPeople'):GetAsync('ABannedList')
end
end)
local Table = game:GetService('DataStoreService'):GetDataStore('BannedPeople'):GetAsync('ABannedList')
game.Players.PlayerAdded:Connect(function(plr)
for i = 1, #BannedList do
if plr.UserId == BannedList[i] then
plr:Kick("Banned Forever.")
end
end
end)
game.Players.PlayerAdded:Connect(function(plr)
for i = 1, #Table do
print(Table[i])
if plr.UserId == Table[i] then
plr:Kick("Banned Forever.")
end
end
end)
game.ReplicatedStorage.DevelopersRemotes.BanRemote.OnServerEvent:Connect(function(plr)
table.insert(RealBannedList, plr.UserId)
game:GetService("DataStoreService"):GetDataStore('BannedPeople'):SetAsync('ABannedList', RealBannedList)
end)

2 comments
From what I've heard and done, using the ROBLOX DataStore to store tables is easier than DataStore2.
Ik, but it still doesn't work :/