Restrictly (V2) - Ban and Unban Players!

DEPRECATED, VIEW V3 HERE

Hello Developers! :smiley:

I’ve made a simple ban module!
Here’s how to get it:

local Restrictly = require(6530046094)

There are currently two commands:

Restrictly.Ban(Player.Name, Reason)
-- Reason becomes "Unspecified Reason" if left blank

and

Restrictly.Unban(Player.Name)

This works with in-game and non in-game players!

Example ban:

local Restrictly = require(6530046094)
Restrictly.Ban("THECOOLGENERATOR", "Exploiting")

Aside from this, the module can also be easily implemented in things such as Admin Panels, and anything else! (In fact, it was originally designed for this purpose too!)

Showcase

This is all for now, thanks for reading, and have a great day! :smiley:

P.S. If you have any questions, concerns or suggestions, please leave them in the comments! Also post your creations with this, I wanna see them


THIS IS NO LONGER SUPPORTED, SEE RESTRICTLY V3 HERE

2 Likes

Um, there is no use for this if it only works for ingame players, you might as well just do

player:Kick(“You are banned.”)

2 Likes

Well there is a use. It saves the data and it keeps the player banned, aka not joining. Kick only removes them from the game once. When I said “for ingame players” i meant the player has to be playing the game to be banned.

1 Like

Going to have to agree with Little_Joes, tbh; being unable to ban users that aren’t in the server is a huge con.

Why don’t you use Players:GetUserIdFromNameAsync()?

3 Likes

I’ll roll that out in the next update.
See the thing is, I was designing a ban system for a dev.
I came up with this idea.

Thanks for the idea though!
(Btw another problem with that is that the module uses Name, not UserId, so I’d have to add some tweaks)

Alright I’m peeking the source for this since I’m curious as to what you’re doing here.

First of all, I think you should document the data store names you’re using (at the time of writing it’s BanData and ReasonData). You’re hiding this from the user (read: other developers using this module), which is unsafe in the event the user wants to use these data stores for their own use.

Second,

function module.Ban(Player, Reason)
	if game.Players:FindFirstChild(Player) then
		print("Player found! - "..Player)
		for _, Plr in pairs(game.Players:GetPlayers()) do
            -- etc.

Not sure why you’re printing “Player found!” when the player has not actually been found yet…

Third,

Bans:SetAsync(Plr.UserId.."-banned", "True")

WHAT on earth are you doing using a string "True" instead of just the boolean value true? This is horrible for efficiency.

Fourth, I don’t know why you’re using two separate data stores for this. You’re using two data store calls for what’s effectively one write operation for the user for no good reason. You should store the ban data in a table, then store that one table in the data store instead, e.g.:

local data = {
    banned = true, -- boolean
    reason = nil -- Use nil to express no reason, else a string
}
Bans:SetAsync(Plr.UserId, data)

Same amount of information stored for one less data store call. Additionally, you can be more memory-efficient if you just assume nil for the reason member is used to represent an unspecified reason instead of writing "Unspecified reason" to the data store.

1 Like

Firstly,
it uses if game.Players:FindFirstChild() and so it prints “Player Found!”
Also, if I leave the reason blank, all it will say is: “You were kicked from this game”. I want it to display the “You were banned”
thanks for the other advice, will look into it

Update Log 1.1

Update Log 1.1
  • Added ability to ban and unban players not in-game
  • Added a few tweaks to make the module more efficient
1 Like

I don’t see how this is any different from any other ban modules. It seems that this one is very limited in what you are able to do, making this completely useless. Also, it appears you are making unneccisary data store calls. And y our datastore solution is inefficient.

I am not trying to go off topic but I don’t see a lot of advantages of using this system. Like, a simple ban and unban system in my administration system i s only around 10-15 lines. It is not even hard to implement that, as it is only some simple Get/Set calls.

Unless this has a significant improvement in terms of performance, then this system would be beneficial, but now, no.

1 Like

Thanks for the advice. However, it’s my first module and it’s been a milestone for me. I’ll continue to update this for anyone who wants to use it.

1 Like

This is 100% obsolete, there are plenty of better alternatives like this ban module made by a co worker and I, GitHub - TyNoOutlet/BanIt: Ban module for Roblox.

2 Likes

Alright then. I never said you have to use it.

I’m confused? I thought there was a v1?

I just updated it! It now features non in-game players ban and unban feature!

u can just use adonis Trello bans lol but this is nice i’ll use it thanks

Alright! There’s an updated version with Server Bans and Unbans here.