so I made a ban command so when you type in the player's name they are banned and so I wanted to make a unban but it seems like all the ways I do it won't work, I'm using a module script just so its only a server ban and not a game ban. Here are my scripts:
--// Local Scripts //--
-- Ban Script --
function Run(args)
script.Parent.Parent.exe.SE:FireServer("",args)
end
game:GetService("UserInputService").InputBegan:Connect(function(e,gpe)
if e.UserInputType == Enum.UserInputType.Keyboard then
if e.KeyCode == Enum.KeyCode.Return then
local text = script.Parent.Text
local txt = script.Parent
if string.find(text:sub(1, 3), "ban") and string.split(text, " ")[2] then
txt.Text = ''
local user = string.split(text, " ")[2]
local reason
if string.split(text, " ")[3] then
local rTable = {}
reason = nil
for i = 3, #string.split(text, " ") do
table.insert(rTable, (#rTable + 1), string.split(text, " ")[i])
end
reason = table.concat(rTable, " ")
end
for _,plr in pairs(game.Players:GetChildren()) do
if (plr.Name:lower():sub(1,#user) == user) then
script.Parent.Parent.exe.BBridge:FireServer(plr, reason)
end
end
end
end
end
end)
-- Unban Script --
function Run(args)
script.Parent.Parent.exe.SE:FireServer("",args)
end
game:GetService("UserInputService").InputBegan:Connect(function(e,gpe)
if e.UserInputType == Enum.UserInputType.Keyboard then
if e.KeyCode == Enum.KeyCode.Return then
local text = script.Parent.Text
local txt = script.Parent
if string.find(text:sub(1, 5), "unban") and string.split(text, " ")[2] then
txt.Text = ''
local user = string.split(text, " ")[2]
script.Parent.Parent.exe.UBridge:FireServer(text)
end
end
end
end)
--// Server Script //--
-- Ban Script --
local bridge = script.Parent.Parent
local playerService = game:GetService("Players")
local bans = require(script.Parent)
local joinMessage = "\nYou Are Banned From This Server."
function kick(player, reason)
playerService[player.Name]:Kick(reason)
end
bridge.OnServerEvent:Connect(function(p, bp, r)
local reason = r
if r == nil then
reason = "No Reason Stated."
end
r = ""
r = "\n\nYou Have Been Banned From The Server!\nReason: " .. reason
table.insert(bans, (#bans + 1), bp.Name)
kick(bp, r)
end)
playerService.PlayerAdded:Connect(function(player)
for i = 1,#bans do
if player.Name == bans[i] then
kick(player, joinMessage)
end
end
end)
-- Unban Script --
local bridge = script.Parent.Parent.Parent.UBridge
local playerService = game:GetService("Players")
local bans = require(script.Parent)
bridge.OnServerEvent:Connect(function(p, bp)
for i = 1,#bans do
if bans[i]:lower():sub(1,#bp) == bp then
table.remove(bans, i)
end
end
end)
--// Module Script //--
-- Banlist --
local bans = {}
return bans
I would be grateful if you could also explain to me how you did it as well so I can learn from this experience. Thanks!

4 comments
why can't you just use data stores for this stuff
also why are you returning a blank module, can't you really just set the table in the script itself and edit that table?
actually i found out i can edit the table in the module
so i'm using that to make it only for a single server and not all the servers