Restrictly V3 - Ban Functions

Restrictly V3


What is Restrictly?

Restrictly is an Open Source Ban system for anyone! At the time of posting, it has 7 commands for people to use! It was designed to be easily implemented into things such as Admin Panels, or just be used by itself!

How to get Restrictly

You can get the ModuleScript for Restrictly here.
Alternatively, you can use this code in Roblox Studio:
require(6530046094)

And if all else fails, use this:

local Module = game.InsertService:LoadAsset(6530046094)
Module.Parent = game.ServerScriptService -- or whatever

Current Commands

There are currently 7 commands.

Restrictly.Restrictly()

Parameters: None
Function: Prints Information such as current module version, current Lua version, rights, etc.

Restrictly.Ban(Player, Reason)

Parameters: Player to ban's name, Reason for ban
Function: Bans a player for the given reason until unbanned. Reason becomes "Unspecified Reason" if left blank.

Restrictly.Unban(Player)

Parameters: Player to unban's name
Function: Unbans a Player.

Restrictly.ServerBan(Player, Reason)

Parameters: Player to ban's name, Reason
Function: Works similar to Restrictly.Ban(), however only bans for the Server.

Restrictly.ServerUnban(Player)

Parameters: Player to Unban's name
Function: Reverses a Server Ban

Restrictly.Restrict(Player)

Parameters: Player to affect's name
Function: Sets a Player's WalkSpeed and JumpPower to 0.012. Makes their screen black, with everything barely visible.

Restrictly.Unrestrict(Player)

Parameters: Player to affect's name
Function: Reverses a Restrict Ban
Note: For these functions (Restrict and Unrestrict) to work, there has to be a ScreenGui named "DarkGui" and a Frame named "DarkFrame" in the DarkGui

Thank you for reading!

If you use this module, please don't claim that you created it! Crediting me is not necessary, however would be greatly appreciated!

Leave your creations down in the comments! If you have any concerns or suggestions, please leave them in the comments!

You can see the showcase here.


That’s all folks, see you around! :happy2:

15 Likes

I read your source code, it would be better to put the reason as the value rather than a bool, and there would be a problem if multiple requires are called on the module script, as there will be more game.Players.PlayerAdded events

EDIT: Roblox caches the result the module script returns and returns that value on future requires to that module script. So the module script will only be ran once. My mistake.

3 Likes

So you’re suggesting that in the Bans store, I should just put the Reason as the content instead of the Bool?

Also, any ideas on getting around the PlayerAdded event?

Yeah. and for the PlayerAdded event, you could do a _G variable

Alright, thanks for the advice. Will consider adding in next update

I see some potential flaws in this module, such as here (I’ve pointed them out):

game.Players.PlayerAdded:Connect(function(Player)
	if Bans:GetAsync(Player.UserId.."-banned") == true then -- unprotected async call
		print("Player is banned! - "..Player.Name)
		if ReasonData:GetAsync(Player.UserId.."-reason") == "" or ReasonData:GetAsync(Player.UserId.."-reason") == nil then -- two more
        ReasonData:SetAsync(Player.UserId.."-reason", "Unspecified Reason") end -- another
		Player:Kick("You have been banned from this game: "..ReasonData:GetAsync(Player.UserId.."-reason")) -- another
	elseif table.find(serverBanned, Player.UserId) then
		Player:Kick("You have been banned from this game: "..GlobalReason)
	else
		print(Player.Name.." - is not banned!")
	end
end)

Putting these problems aside, why use this module instead of mine:

or my main competitor’s:

in which both are arguably better as far as services go?

2 Likes

Because why not?

Also, they basically have the same functions. I’ll add timed ban at the next major update. Thank you for pointing out the flaws, however.

Wouldn’t take this advice, bad practice to use _G as shared is the replacement for the deprecated _G.

What is the point of this module when we can use other well established admin / ban systems?

@Ty_Scripts

why use this module instead of mine:

The 2 modules you mentioned are also on the same boat as this module, both are equivalent and provide no usefulness.

That’s not how multiple require calls work on module scripts.

If the module has been required already, it returns the reference to the table that was returned the first time. Otherwise Class modules and other OOP code would be useless.

3 Likes

Thanks for the info, I never knew that!

Because none of these three are admin systems? Some developers don’t like admin systems, or prefer to make their own. They do provide usefulness if you don’t want to/don’t know how to make ban systems.

Update Log 3.2

Update Log 3.2
  • Minor tweaks to Data Store Calls, added protection from erroring
  • Minor tweaks to script
2 Likes

My point still stands, just because developers don’t like to make their own systems, doesn’t mean that your module is useful, it at least needs to provide an utility that developers that are using it may find useful, many of the functions that your module provides are almost guaranteed to be available in every admin system and anyone can implement those in under 10-15 minutes.

@OP: By looking at the source, this module is definitely not reliable and contains many bad practices.

You aren’t handling any errors that GetAsync and SetAsync throw, since they are asynchronous functions.

These types of error handling is not successful, since all you’re doing is just pcalling them and printing out errors, not even retrying if they fail:

					Bans:SetAsync(Plr.UserId.."-banned", true)
				end, function(err)
					print("Error whilst setting Ban Data")
					warn(err)
				end)

Your module also relies on GetUserIdFromNameAsync to never error, which is also a huge flaw, since it is also an asynchronous function and is prone to errors. Another flaw is how this module uses SetAsync very frequently, even though it is for different keys, it still isn’t a good solution.

Most of the functions that this module provides are found in every admin system, the only difference is that this one isn’t reliable, I wouldn’t consider this module.

2 Likes

Update Log 3.3

Update Log 3.3
  • Added Restrictly.Restrict() and Restrictly.Unrestrict(), see post for functions
  • Note: For these functions to work properly, there has to be a ScreenGui named “DarkGui” and a Frame named “DarkFrame” in the DarkGui
1 Like

Does anyone have any ideas for this module? Please reply to this post if you have any!

questions

  1. If Roblox DataStoreService Broke, Do Banned Players Have Access Again?
  2. If The Banned Player Is Offline, Are They Still Banned?

I don’t see the point in using this with the source being so badly written.

1 Like

It’s only work with the model owner, I think.

Which one is the right one?

1 Like

Oops, sorry. It currently has 7 commands. I’ll fix it right now.

1 Like