Moderation system

good evening!

im starting this thread to ask for some more experienced scripters, especially those who have worked with or who have created moderation systems (i.e. chat filtering - ik there’s autofilter, but still - kicking, banning, server announcing, etc.) to give me some input on what i should focus on specifically if i want to create a moderation system. im not looking for anyone to like give me a full tutorial or anything, i just want to know where to get started i guess!

There are many ways to accomplish what you’re trying to do. Kicking players can be done by calling :Kick() on a Player which will remove them from the game. You can combine this with DataStores to create a ban system by saving banned players so when they join, they get kicked instantly. Server announcements can be made by sending messages in chat via a RemoteEvent fired to all players that displays a message. I believe Roblox is working on a moderation API at the moment to make moderation easier, but for the time being you will need to create your own system.

2 Likes

awesome! thank you. are there any resources through dev forum, or through other websites (maybe like the roblox doc, or a third party website) where i could learn more info about these things?

Here’s some resources I’ve found:
Player:Kick()
DataStores Tutorial
RemoteEvent
Basic Command System
If you have any questions, feel free to ask!

1 Like

ignore the last post i had made, if i wanted to add a custom kick message when kicking someone, how would i go about doing that? i havent been able to find a post to help me with that. here’s what i have, kick command wise.

local Commands = {
	["kick"] = {
		Alias = nil,
		Func = function(caller, arguments)
			local Targets = findPlayerByString(caller, arguments[1])
			
			for _, player in pairs(Targets) do
				
				game.Players:FindFirstChild(player.Name):Kick("bye")
				
			end
		end,
	}
}

to be clear, it already automatically will kick the specific player for “bye”, but how would i go about kicking them for the reason the administrator gives? so if i said “.kick player get kicked lol”, it would show that, rather than a pre-set message.

It’s quite easy to achieve this. I have provided a code sample below, as well as improved some of your code by directly passing a player instance instead of a name. This is better because it eliminates the need for a for loop, thus improving performance. Make sure you call this function from the server!

local commands = {}
commands.kick = {
    func = function(target, reason)
        if not target then
            error("Expected a Player Instance")
        end
        
        reason = reason or "No reason provided" -- the custom kick message
        target:Kick(reason)
    end
}

-- example usage:
commands.kick(game:GetService("Players").shifted_bit, "Test kick")