I'm trying to make an admin panel that bans a player when I enter the player name, reason and then press the ban button (gui button) then the players userId should be inserted into a table.
I'm trying to send a string value of the players name to the server script to ban them using a for i, v loop.
Local script code to detect when the button is pressed:
local Main = script.Parent.Main
local WhoFrame = Main.WhoFrame
local PlrName = game.ReplicatedStorage.PlrName
Main.WhoFrame.BanButton.MouseButton1Click:Connect(function()
PlrName.Value = WhoFrame.PlayerList.Text
game.ReplicatedStorage.BanPlayer:FireServer()
end)
PlrName is the string and player list is where I type the players name into.
Server script 1:
local GetList = game.ReplicatedStorage.GetList
local BanPlr = game.ReplicatedStorage.BanPlayer
local PlrName = game.ReplicatedStorage.PlrName
local BanList = {}
BanPlr.OnServerEvent:Connect(function(player)
for i, v in pairs(game.Players:GetPlayers()) do
if PlrName == v then
table.insert(BanList, player.UserId)
print("Player is in ban list")
end
end
GetList.OnInvoke = function(Player)
for i, v in pairs(BanList) do
if v == Player.UserId then
print("Player Is In The Ban List")
return true
else
print("Player is not in the ban list")
return false
end
end
end
end)
Server script 2 (detects when the player logs back on)
local GetList = game.ReplicatedStorage.GetList
game.Players.PlayerAdded:Connect(function(player)
local IsPlayerBanned = GetList:Invoke(player)
if IsPlayerBanned == true then
player:Kick("You are banned")
end
end)
Thanks for reading!
(Sorry if the code is confusing I followed a manual tutorial and tried to make it automatic)

2 comments
You never actually sent any arguments through :FireServer() :|
What kind of arguments should I send through FireServer() would things like the player work?