-- LocalScript for GUI
local gui = script.Parent
local playerNameInput = gui.MainFrame.PlayerNameInput
local kickButton = gui.MainFrame.KickButton
local banButton = gui.MainFrame.BanButton
-- Services
local players = game:GetService("Players")
kickButton.MouseButton1Click:Connect(function()
local playerName = playerNameInput.Text
if playerName then
-- Fire RemoteEvent to server to kick player
local kickEvent = gui.KickEvent
if not kickEvent then
kickEvent = Instance.new("RemoteEvent")
kickEvent.Name = "KickEvent"
kickEvent.Parent = gui
end
kickEvent:FireServer(playerName, "kick")
end
end)
banButton.MouseButton1Click:Connect(function()
local playerName = playerNameInput.Text
if playerName then
-- Fire RemoteEvent to server to ban player
local banEvent = gui.BanEvent
if not banEvent then
banEvent = Instance.new("RemoteEvent")
banEvent.Name = "BanEvent"
banEvent.Parent = gui
end
banEvent:FireServer(playerName, "ban")
end
end)
If you are a developer looking to create a robust Kick/Ban system for your game, your GUI must rely on Server Authority.
UserId to a table in a DataStore. When a player joins (PlayerAdded), check if their ID is in that table.The GUI is a standard ScreenGui with TextButtons for each player. When an admin clicks "Kick," the client does not kick the player directly. Instead, it sends a signal to the server. fe kick ban player gui script op roblox exclusive