Credits
dukzae - Comment that helped us: I would recommend putting your code in the Lua format so it is easier to read.
local hello = game.Workspace
Tutorial
Hey guys! This is my first tutorial on the DevForum, so please do not expect it to be as amazing as you would expect from a experienced developer.
So first, what you want to do is a create a new Script inside of “ServerScriptService”, name it whatever you want!
Now what we want to do is creating a new table, that will store all our bans:
local Banned = {“someoneuhate”}
Now what we want to do is to make it so when the player joins, we will execute a function.
game.Players.PlayerAdded:Connect(function(player)
Now, do enter, should looks like this:
game.Players.PlayerAdded:Connect(function(player)
end)
Inside of our function we want to check if the player is in our banned table:
if table.find(Banned, player.Name) then
end)
Now you want to disconnect the player in the table we just created from the server:
if table.find(Banned, player.Name) then
player:Kick()
end)
You also want to destroy them so they don’t change there kick message.
if table.find(Banned, player.Name) then
player:Kick()
wait(2)
player:Destroy()
end
Now enjoy your ban system to keep these hackers out!
Full script:
local Banned = {“ROBLOX”}
game.Players.PlayerAdded:Connect(function(player)
if table.find(Banned, player.
Name) then
player:Kick()
wait(2)
player:Destroy()
end)
end