(Sorry if this is bad this is my first tutorial)
Hello new developers! If exploiters have taken control of your game, you want to get rid of them, right? Here’s a simple auto-kick script for you, server-sided and protected from exploits!
- Add a script to Server Script Service.
- Type the following:
game.Players.PlayerAdded:Connect(function(player)
end)
Here’s how it works. Every time a player joins, the function fires. The first argument (in this case, player
), is the player that joins.
3. In the function, type in this:
if player.Name == "INSERT_PLAYERNAME_HERE" then
end
so your script should be like this:
game.Players.PlayerAdded:Connect(function(player)
if player.Name == "INSERT_PLAYERNAME_HERE" then
end
end)
Now, the moment the player joins it checks the name of the player (player.Name
). After that comes the last bit of code:
3. The actual kicking
game.Players.PlayerAdded:Connect(function(player)
if player.Name == "INSERT_PLAYERNAME_HERE" then
player:Kick("Kick message here")
end
end)
using the :Kick
function on the player that should be banned, it will automatically ban the player once the loading screen goes in.
To show you how it works, here’s a video of me kicking myself (Replacing the "INSERT_PLAYERNAME_HERE"
part with my actual username):
And if you want to add another person, just add an
or
statement, like this:
if player.Name == "INSERT_PLAYERNAME_HERE1" or player.Name =-"INSERT_PLAYERNAME_HERE2" then
So that’s how to make a simple auto-kick script! Thanks for reading this!