So in my game I want to use a datastore to save all new banned players from my game into a table without having to go in and manually edit them how do I save the table and then re-access it upon server start.. The documentation on Datastores and Tables doesn't say anything about saving/accessing them although I know its possible I just don't know how..
local DataStore = game:GetService("DataStoreService"):GetDataStore("BannedList")
local bans = {""} -- table I want to save
local admins = {"admin"}
local victim
function tableContains(t, value)
for _, v in pairs(t) do
if v == value then
return true
end
end
return false
end
function findPlayer(name)
for _, player in ipairs(game.Players:GetPlayers()) do
if player.Name:lower() == name:lower() then
return player
end
end
end
game:GetService("Players").PlayerAdded:connect(function(player)
player.Chatted:connect(function(msg)
if msg:sub(1, 4) == "ban/" and tableContains(admins, player.Name) then -- where someone gets banned
victim = findPlayer(msg:sub(5))
if victim then
end
end
end)
