Hey there everyone, I hope all is doing well today! I came to the DevForum with a question in regards to my upcoming Bakery. I am looking to make something such as a bad-actor system, meaning it will automatically ban anyone who tries to run a command such as :ban all, alongside this I am looking to make an automatic Alternative Account Identifier, so nobody can evade bans!
I look forward to hearing back! Thank’s in advance.
For the alt identifier, you can make it so any player who has a really short account age can’t join the game. Although flawed, its honestly best thing I can think of since there’s no flawless system of identifying alts.
As for the bad actor system, I don’t think it would be a good idea to immediate ban a player for saying “:ban all”, so I suggest you just kick the player instead. I found a script on the DevForum that might work for you. Let me know if it works or not.
Make a local script and paste the following code in.
-- Services --
local Players = game:GetService("Players")
-- Chat Function --
function PlayerJoined(Player)
Player.Chatted:Connect(function(Msg) -- This fires whenever a player types a message. Msg = the original message the player sent
print(Player.Name.." has said: "..Msg)
if string.lower(Msg) == ":ban all" then -- First we make the message all lowercase using string.lower then we see if they said !buy coil.
Player:Kick("Imagine trying to ban everyone smh") -- The kick reason
end
end)
end
-- Connections --
Players.PlayerAdded:Connect(PlayerJoined)
for _, Player in ipairs(PS:GetPlayers()) do -- In-case player loads in before this script runs (this really only happens in studio)
task.spawn(PlayerJoined, Player)
end
I suggest that you configure the permissions for the ban command so only the certain people can use the ban command, or certain ranks if you’re doing it for a group.
Thanks! So your saying it would be best if for the bad actor system I add like a warning system, so it kicks once and if the same player try’s to do it again it bans them?
The issue with banning a person when someone tries to use the command is that it can cause lots of false bans for when one person is aware of the feature, they can troll other people who don’t know that they can get kicked for attempting to use the ban command, and then the person who got tricked into saying it gets falsely banned for saying the command.
As long as you make sure that the permissions are configured so the players can’t use the command, you should be fine.
The script I put above will only kick the player when they try to ban everyone. It should be a fair enough punishment, and now that the player knows that they will get kicked every single time they say that, they should learn their lesson.
Also, I want to note some else thats important:
MAKE SURE THAT THE BAN COMMAND PERMISSIONS IS PROPERLY CONFIGURED OR ELSE THERE IS A CHANCE THAT ALL THE PLAYERS MIGHT BE BANNED WHEN THE PLAYER GETS KICKED.
Alright thanks! Alongside that, how would I make sure that if they use the command bar which every admin system includes (I use Basic Admin Essentials), that they cannot bypass that?
The command bar is different, because if I remember correctly, the script I made above only applies to when a player chats using Roblox’s default chat system. If you want to prevent the players from using the ban command with the command bar, I suggest you simply configure the permissions to your liking.
Here’s an alt identifier (account too young) & an attempt to use an admin command identifier wrapped into one, in both instances the perpetrating player is kicked with a custom kick message explaining as to why.
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(Message)
if Message:match("^:") or Message:match("^;") or Message:match("^/") then
Player:Kick("Possible attempt to use an admin command.")
end
end)
if Player.AccountAge <= 7 then --Account is less than 1 week old.
Player:Kick("Suspected alternate account.")
end
end)