ModerationService - Simplyifying Moderation

ModerationService - Simplifying Moderation

Owned by Anonymous Systems

This project is fairly new, excpect bugs & more
“Simplifying Moderation”

Recent Updates

Version 1.0.0:

  • ModerationService Released
  • Ban, Kick, Warning Features Added
  • Check Ban, View Warnings, Unban Features Added
  • Banning
  • Kicking
  • Adding Warnings
  • Viewing Warnings
  • Removing Bans
  • Ban Checking
  • Time Banning

Offical Anonymous Systems Group
Github Link
ModerationService Module

Please only provide constructive criticism! This is a new service owned by Anonymous Systems. This is not a chat command or a user interface panel This module allows you to call: Ban(); Kick(); and other similar functions, allowing you to integrate it into your own chat commands and GUI Panels. This project is open-sourced, which means you can modify it in any way you see fit.

This uses MessagingService, which means you can kick and ban players across servers. Guess what? The module also allows you to ban players who are offline!


@CodedJer - Coding ModerationService
@InfiniteBlackPIX - Advice, Help with MessagingService
@screenswitch1 - Helping with a datastore problem (tysm)
@LightningLion58 - Helping with time ban
@Gooncreeper - Ideas


How can you contribute? You can suggest more features, help improve the code, etc.

Please report any bugs, issues, typos you find and they will be fixed!


Will you be using ModerationService?
  • I will not be using ModerationService
  • I will be using ModerationService

0 voters

What do you think about ModerationService?
  • This module is very good
  • This module can be improved
  • This module sucks

0 voters


A feature you could add would be temp banning people (can already be made using ban & unban functions provided, but a tempban function would make it easier)


I have already planned that, glad to see other people want this added!

1 Like

Where’d you get this idea?

1 Like

Offline kicking? :thinking:

Would you kick them at the first time they join the game?


Oops, accidentaly said kicking, I’ll fix that.

I mean that’s an idea :eyes:


I was reading some posts on the dev forum of users wanting roblox to add a service called “BanService” with :Ban() and :Unban() methods, so I decided to make a resource called “BanService” But I wanted to add more such as warnings so I changed it to be “ModerationService”.

1 Like

this is better then my resource

But cant you just make a panel so you dont have to shut down the game?

1 Like

What do you mean by “shutdown the game”

1 Like

Shutdown the game to update the ban list.

1 Like

Hm? This doesnt shutdown the game to update the banlist? why’d you think that?

1 Like


im dumb enough to not realize that
But can you ban other mods?

1 Like

As this module is not integrated into any admin system, yes you can kick mods, if the developer is integrating this to an admin panel/chat commands they are the people responsible to integrate anti-mod kicking!

1 Like

Quick Update - Nothing Serious

  • Removed a testing print I forgot to remove
  • Added a version checker so you will always know if you are not updated!
1 Like

Can you add temp banning so you can specify a time for the player to be banned


This is planned for the next update!

1 Like

Important hotfix

Warning function had an issue where it would only keep the first warning and override the others with the new one, this has been fixed with this update.
Thank you so much @screenswitch1

1 Like

This could really use profileservice (module)
As this module simply wraps up datastore call functions profileservice would allow for extremely safe and secure datastore saving and crap preventing those who shouldnt be there from well being there

(it also caches so you don’t end up queueing up like 30 calls if you try checking warnings that much for some reason)


This comment is going to be mostly code review
Im going to just throw out alot of stuff here
and not alot of explaining

Code Simplification

When erroring you don’t need to return the error | return error()
When checking if a variable exists you can use assert() Example:

--old method
if UserId == nil then return error("Parameter UserId is nil") end
--better method
assert(UserId, "Parameter UserId is nil")
--even better method (checks that it is a number)
assert(type(UserId) == "number", "Parameter UserId is invalid")

Now looking further on I’m not sure why you didn’t use self here:

local Warnings = service:viewWarnings(UserId)
--could be
local Warnings = self:viewWarnings(UserId)

I would strongly recommend using self here because you are defining your function with : instead of .

Instead of doing this to default

if Reason == nil then Reason = DefaultReasonBan end
--You can do
Reason = Reason or DefaultReasonBan

With checking if the player is still there before kicking

local Player = Players:GetPlayerByUserId(UserId)
if not Player then return end

--There are two alternatives; I reccomend the second
local Player = Players:GetPlayerByUserId(UserId)
if Player then

local Player = Players:GetPlayerByUserId(UserId)
_ = Player and Player:Kick(Reason)

Explanation for the second here: (I made this : clout)

I am very disapointed in this pcall:

local Key = "-Ban"..UserId
local success, result = pcall(function()
	ModerationDatastore:SetAsync(Key,{Reason, Moderator})
if not success then
	warn("[ModerationService] Failed to Set DataStore Value for "..UserId..".\nError:",result)

You should really really really really really do it like this:

		warn("[ModerationService] Failed to Set DataStore Value for ",UserId,".\n\tError:", ...
	end, ModerationDatastore, Key, {Reason, Moderator}

Time to throw more sources at you

I am going slightly insane looking at your code.
on :CheckBan
i uh
Did you know?
you can return multiple arguments:

return {false,false}
return false, false

--thank you

Instead of concatinating stuff on warn functions like this:

warn("you did bad things" .. player.UserId)

You can do:

warn("you did good things", player.UserId)

its just so much cleaner

Did you know:
tables can have indexes;

local TheGreatestTableAlive = {}
TheGreatestTableAlive.Banned = false
TheGreatestTableAlive.BanReason = "you did something"

it will make your code much more readable, and give developers interacting with your api a good time.

Using this new knowledge:
Apply this to every part of the module; thank you.
After that; I’ll inspect further into the module.

If you need clarification on anything I have said so far, I will be happy to help because I wrote this is five seconds and then did not read it and then clicked the post button and then hoped you would read this and then hoped something spectaculous would happen.

ps. I like the module.


The old method is safer as using assert can lead to memory leaks and can slow down your process, here is a forum explaining this. So I would simply make your own assert function like this

local function Assert(condition, func)
   if not condition then
      error(func(), 2)
   return condition